You are not logged in.
I maintain the craftbukkit AUR package and lately I've noticed that `/etc/rc.d/craftbukkit` {start/restart} says [DONE], despite the fact that it's anything but that. I tried checking the .rc script for craftbukkit, and explicitly executing the command to run it works fine, so... I'm stumped.
Here's the script for the daemon:
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
BACKUPPATH="/opt/craftbukkit/backup/"
WORLDPATH="/opt/craftbukkit/world/"
save_stop() {
su -s /bin/bash -c "tmux send-keys 'save-off' C-m" craftbukkit
su -s /bin/bash -c "tmux send-keys 'save-all' C-m" craftbukkit
}
save_start() {
su -s /bin/bash -c "tmux send-keys 'save-on' C-m" craftbukkit
}
case "$1" in
start)
stat_busy "Starting craftbukkit daemon"
PID=`pgrep -f -n 'craftbukkit.jar'`
if [ -z "$PID" ]; then
# RUN
su -s /bin/bash -c "tmux new-session -d 'cd /opt/craftbukkit; java -Xmx1024M -Xms1024M -jar /opt/craftbukkit/craftbukkit.jar nogui'" craftbukkit
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
add_daemon craftbukkit
stat_done
fi
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping craftbukkit daemon"
PID=`pgrep -f -n 'craftbukkit.jar'`
# KILL
[ ! -z "$PID" ] && kill $PID &> /dev/null
#
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
rm_daemon craftbukkit
stat_done
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
backup)
stat_busy "Starting backup"
FILE="`date +%Y%m%d%H%M`.tar.gz"
path="$BACKUPPATH/$FILE"
su -s /bin/bash -c "mkdir -p $BACKUPPATH" craftbukkit
save_stop
su -s /bin/bash -c "tar -czf $path $WORLDPATH" craftbukkit
save_start
stat_done "Backup finished"
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0I'm hoping someone can spot something amiss with the code.
Hardware: Gigabyte X570 AORUS Pro, AMD Ryzen 5900X, Nvidia GTX 1080, 32 GB DDR4 RAM
Choice software: Arch Linux 64-bit with KDE desktop / Windows 11 Home 64-bit
Offline
Are you using systemd or initscripts?
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline