again nohup
This commit is contained in:
parent
094ba3631d
commit
55e0afe415
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ Cargo.lock
|
||||
**/*.rs.bk
|
||||
*.pdb
|
||||
/target
|
||||
output.log
|
||||
|
38
manage.sh
Normal file
38
manage.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
start_monitor() {
|
||||
nohup cargo run --release > output.log 2>&1 &
|
||||
sleep 1
|
||||
echo "Monitor started"
|
||||
}
|
||||
|
||||
stop_monitor() {
|
||||
if [ -f /tmp/mtemp-monitor.pid ]; then
|
||||
pid=$(cat /tmp/mtemp-monitor.pid)
|
||||
echo "Stopping monitor with PID $pid"
|
||||
kill $pid
|
||||
rm /tmp/mtemp-monitor.pid
|
||||
echo "Monitor stopped"
|
||||
else
|
||||
echo "Monitor is not running (PID file not found)"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start_monitor
|
||||
;;
|
||||
stop)
|
||||
stop_monitor
|
||||
;;
|
||||
restart)
|
||||
stop_monitor
|
||||
sleep 1
|
||||
start_monitor
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user