I have a script /etc/init.d/startup
, where I do the following:
- creating a PID file that should look like:
/var/run/**startup**.pid
- executing a screen of a java process, so I will like to create the screen with the name startup (like this screen -dmS startup "path to a script"
I don't have any problems with the any of the above while the server is running, but when it boots up it creates the PIDfile and screen with the incorrect names like this:
/var/run/**S92startup**.pid
2058.**S92startup** (11/10/2014 03:56:31 PM) (Detached)
How can i assign the name of the script while booting? (not the name of the symlink in /etc/rc2.d/
)
Right now my script looks like this at the beginning and this is how I'm getting the name of the script
SCRNAME=${0##*/}
DAEMON="screen -DmS $SCRNAME /srv/startup/scripts/gprs.sh"
PIDFILE=/var/run/$SCRNAME.pid
PS: it is working right when i'm on the server and execute "service startup start" but not when booting.