Script for start, stop and restart the processe. And also it shows the status.
#!/bin/bash
server_root=~/path/to/my/working-directory
log_file=$server_root/path/to/log/log.file
startme() {
cd $server_root
first_command &
second_command &
}
stopme() {
pkill -f "1st_process_name"
pkill -f "2nd_process_name"
}
statusme() {
tail -f $log_file
}
case "$1" in
start) startme ;;
stop) stopme ;;
restart) stopme; startme ;;
status) statusme ;;
*) echo "Usage: $0 start|stop|restart|status" >&2
exit 1
;;
esac