[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

OT: How to recursively call a script?



OT: How to recursively call a script?




I've got a Solaris box, and I need to remotely restart the 
ssh daemon. On Debian, most init scripts have a "restart" 
option. Solaris apparently doesn't (what's with that?!).

The script looks roughly like this:

#!/bin/sh

case $1 in
'start')
Ê /usr/local/sbin/sshd
Ê ;;
'stop')
Ê {code to stop the PID of sshd}
Ê ;;
esac

I'd like to add a stanza like:

'restart')
Ê /etc/init.d/sshd stop
Ê /etc/init.d/sshd start
 ;;

just before the "esac". However, when I run the script 
(locally, not ssh'd in), the sshd daemon starts, but never 
starts again. I'm not scripting wizard, so I may be doing 
something obviously wrong, but it seems like it out to 
work.

Secondly, assuming the script is made to work, will it work 
remotely, or will the process be killed when the sshd 
daemon goes down because it's a process spawned from 
an incoming ssh connection that's a "sub-process" of that 
sshd daemon?

I know, I know. it's a Solaris question, so I should be 
asking on a Solaris list. But you guys are awesome, and 
it's Debian that gave me the idea to do a restart anyway, 
so hope you'll forgive the OT question.

Thanks!

-- 
Kent




Reply to: