Start JBoss 7 as a service on Linux

After spending a couple of hours of snooping around I ended up creating /etc/init.d/jboss with the following contents #!/bin/sh ### BEGIN INIT INFO # Provides: jboss # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop JBoss AS v7.0.0 … Read more

How can I log the stdout of a process started by start-stop-daemon?

To expand on ypocat’s answer, since it won’t let me comment: start-stop-daemon –start –quiet –chuid $DAEMONUSER \ –make-pidfile –pidfile $PIDFILE –background \ –startas /bin/bash — -c “exec $DAEMON $DAEMON_ARGS > /var/log/some.log 2>&1” Using exec to run the daemon allows stop to correctly stop the child process instead of just the bash parent. Using –startas instead … Read more

How to process SIGTERM signal gracefully?

A class based clean to use solution: import signal import time class GracefulKiller: kill_now = False def __init__(self): signal.signal(signal.SIGINT, self.exit_gracefully) signal.signal(signal.SIGTERM, self.exit_gracefully) def exit_gracefully(self, *args): self.kill_now = True if __name__ == ‘__main__’: killer = GracefulKiller() while not killer.kill_now: time.sleep(1) print(“doing something in a loop …”) print(“End of the program. I was killed gracefully :)”)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)