Am 21. Jul, 2002 schwätzte Robert Bushman so:
> I've got a startup script for a deamon I'm using,
> which looks like this:
>
> #!/bin/sh
> ./squeak -headless squeak.image start.st &
>
> Works great. Problem is, squeak, squeak.image,
> and start.st are all files. squeak is an
> executable, so I can link it from /usr/bin.
> squeak.image can be referenced absolutely
> (/usr/local/lang/squeak/squeak.image). But
> when I reference start.st absolutely, it
> doesn't work. I could softlink start.st in
> /etc/rc.d/init.d, but that seems like an
> unprofessional solution.
Yeah, not a good thing.
> So I tried:
>
> #!/bin/sh
> cd /usr/local/lang/squeak/apps/swiki/
> ./swiki.sh
Put a 'pwd' after the cd to verify you changed directories. You should have
changed dirs or gotten an error is you don't have perms to get into that dir
( the dir not existing is definitely lack of perms :).
> and put swiki.sh and start.st in the apps/swiki
> directory, but no dice. It can't find swiki.sh,
> so I'm assuming the cd isn't doing what I think
> it should.
What is swikit.sh? Does it exist? Is it executable?
> So what am I doing wrong? How do I cd within a
> shell script?
Just like you did.
If you just need it for a single commandk, then stick it in a parens.
( cd somewhere; run-command )
That uses a subshell, so avoid doing that in loops that run many, many
times.
$ cat /etc/init.d/swiki
#!/bin/sh
/usr/bin/squeak -headless /usr/local/lang/squeak/squeak.image
/usr/local/lang/squeak/start.st &
That's what it should look like if everything worked. Actually there should
be start and stop stuff :). Does swiki come with an example startup script?
ciao,
der.hans
--
#
https://www.LuftHans.com/
# Stell dir vor, es ist Krieg und keiner geht hin...