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.
dotplan-online/ctl

30 lines
466 B
Plaintext
Raw Normal View History

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
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