-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrunonce2
executable file
·38 lines (31 loc) · 981 Bytes
/
runonce2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# New TomeNET server startup script
# This script uses the tomenet.pid file in lib/data and should cause less problems
# You can use cron to run this script every minute
PIDFILE=lib/data/tomenet.pid
PATH=/bin:/usr/bin:/usr/local/bin
#cd /home/$USER/tomenet
ulimit -c unlimited # allow core dumps
if [ -f $PIDFILE ]
then
TOMENETPID=`cat $PIDFILE`
if [ `ps ux | grep "\./tomenet\.server" | grep " $TOMENETPID " | grep -v -c grep` = 1 ]
then
exit
fi
#rm -f $PIDFILE
fi
if [ -f core ] ; then
mv core cores/core.`date +"%Y%m%d%H%M%S"`
fi
if [ -f tomenet.server.core ] ; then
mv tomenet.server.core cores/core.`date +"%Y%m%d%H%M%S"`
fi
if [ -f lib/data/tomenet.log ] ; then
bzip2 lib/data/tomenet.log
mv lib/data/tomenet.log.bz2 lib/data/`date +"%Y%m%d%H%M.log.bz2"`
fi
echo "Server seems to be dead, killing tomenet.server and evilmeta and starting tomenet.server"
killall -9 tomenet.server
killall -9 evilmeta
./tomenet.server >/dev/null 2>&1 &