Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • are you saying that your latest version with echo $PID > $PIDFILE doesn't work? Are you sure there is a value for $PID. Add an echo PID=$PID to debug.. Otherwise, look at the permissions to your /var/run dir where you are writing the $PIDFILE. the process that is running the script must have write privileges in bot /var and /var/run. Good luck. Commented Apr 3, 2015 at 2:50
  • @shelter: No in first script it was not creating the pid file where I have mentioned daemon --pidfile PIDFILE. But in second I am creating it using echo $PID > $PIDFILE and it is working perfectly. Commented Apr 3, 2015 at 5:46
  • In first script there was a problem that if my program crashes then lockfile was not getting deleted and it was failing in starting the application but the second version is more reliable. Commented Apr 3, 2015 at 5:47