/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
I intend to show a shell script for Jetty 8 server which is installed in /opt/jetty-distribution-8.1.0.RC2/ (path on my virtual server). The script checks the process id of the running Jetty server, kills it if it was found and restarts the server with the command "nohup java -jar start.jar".
#! /bin/sh jettyPid='pgrep -f "java -jar start.jar"' if [ "$jettyPid" != "" ] then kill -9 $jettyPid fi jettyHome="/opt/jetty-distribution-8.1.0.RC2/" cd $jettyHome nohup java -jar start.jar exitAlternative shorter variant:
#! /bin/sh pgrep -f "java -jar start.jar" | xargs -i kill {} cd /opt/jetty-distribution-8.1.0.RC2/ nohup java -jar start.jar exit
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.