Search code examples
sleepksh

Using [ nohup ksh ] to run a script cannot see the sleep process


I am using CentOS 7.6 and bash shell inside VirtualBox .

I came across a script named MotherScript in my site having this statement :

nohup ksh MyScript &

Both MotherScript and MyScript have a shebang line

#!/bin/ksh

After login, I just fire the MotherScript.

In my previous companies, usually, I used this statement :

nohup MyScript &

Is there any functional/strange/usage difference between these 2 statements ?

Inside MyScript, there is a sleep command to sleep 1 hour repeatedly in a while loop for 7 days.

However, very strange, I cannot see this sleep process using :

ps -ef | grep sleep

Therefore, I cannot kill the sleep process.

Does this nohup ksh play the trick ?

Anyone know the reason behind ?

Thanks. Alvin


Solution

  • One solution to your issue could be to launch the script using bash instead of ksh. ksh does not seem to generate a PID/process for the sleep...

    The reasoning behind this "feature" of ksh would be very interesting to hear about.