This repository has been archived on 2022-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
2020-07-16 23:55:59 -05:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
cmd=$1
|
|
|
|
|
|
|
|
killserver() {
|
|
|
|
if [ -f "dotplan.pid" ]; then
|
|
|
|
kill -9 $(cat dotplan.pid)
|
|
|
|
rm dotplan.pid
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$cmd" = "run" ]; then
|
|
|
|
killserver
|
|
|
|
perl server.pl
|
2020-07-17 21:36:12 -05:00
|
|
|
elif [ "$cmd" = "daemon" ]; then
|
|
|
|
killserver
|
|
|
|
perl server.pl -d
|
2020-07-16 23:55:59 -05:00
|
|
|
elif [ "$cmd" = "kill" ]; then
|
|
|
|
killserver
|
|
|
|
elif [ "$cmd" = "initdb" ]; then
|
|
|
|
if [ -f "users.db" ]; then
|
|
|
|
rm users.db
|
|
|
|
fi
|
|
|
|
cat schema.sql | sqlite3 users.db
|
|
|
|
else
|
|
|
|
echo 'Usage: ctl [command]'
|
|
|
|
echo
|
|
|
|
echo 'Commands:'
|
|
|
|
echo ' run'
|
|
|
|
echo ' kill'
|
|
|
|
echo ' initdb'
|
|
|
|
fi
|