1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

sysvinit to make from scratch

This commit is contained in:
src386 2015-08-31 17:27:43 +02:00
parent 7cdbb4fcfa
commit 062e121eab
2 changed files with 9 additions and 3 deletions

1
TODO
View file

@ -1 +1,2 @@
- Check if Yes and yes are both working - Check if Yes and yes are both working
- Sysvinit script syslog

View file

@ -24,6 +24,8 @@ is_running() {
[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
} }
. /lib/lsb/init-functions
case "$1" in case "$1" in
start) start)
if is_running; then if is_running; then
@ -32,13 +34,16 @@ case "$1" in
echo "Starting $name" echo "Starting $name"
cd "$dir" cd "$dir"
if [ -z "$user" ]; then if [ -z "$user" ]; then
sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & log_failure_msg "user \"$user\" does not exist"
else else
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & sudo -u "$user" $cmd >> log_daemon_msg 2>> log_failure_msg 1 &
fi fi
status=$?
log_end_msg $status
echo $! > "$pid_file" echo $! > "$pid_file"
if ! is_running; then if ! is_running; then
echo "Unable to start, see $stdout_log and $stderr_log" log_failure_msg "Unable to start, see syslog"
exit 1 exit 1
fi fi
fi fi