mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
revert to movim.init original
This commit is contained in:
parent
b8738650ef
commit
5d72b2b52b
2 changed files with 79 additions and 57 deletions
|
@ -17,7 +17,6 @@ Current Movim version : 0.9 git2015-08-31
|
||||||
- script/remove now delete 'movim' user only after Movim service is stopped.
|
- script/remove now delete 'movim' user only after Movim service is stopped.
|
||||||
- script/update now updates php dependancies (composer update).
|
- script/update now updates php dependancies (composer update).
|
||||||
- conf/movim.service now has a PID and a syslog identifier.
|
- conf/movim.service now has a PID and a syslog identifier.
|
||||||
- conf/movim.init now uses logger (syslog support) and is more reliable.
|
|
||||||
- conf/nginx.conf : proxy_read_timeout and proxy_send_timeout removed (default is 60s)
|
- conf/nginx.conf : proxy_read_timeout and proxy_send_timeout removed (default is 60s)
|
||||||
- conf/php-fpm.conf add timezone parameter.
|
- conf/php-fpm.conf add timezone parameter.
|
||||||
|
|
||||||
|
|
109
conf/movim.init
Executable file → Normal file
109
conf/movim.init
Executable file → Normal file
|
@ -5,71 +5,94 @@
|
||||||
# Required-Stop: $remote_fs $syslog
|
# Required-Stop: $remote_fs $syslog
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Movim
|
# Short-Description: Start daemon at boot time
|
||||||
# Description: Kickass social network
|
# Description: Enable service provided by daemon.
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
dir="YHDIR"
|
||||||
|
cmd="php daemon.php https://YHURL YHPORT"
|
||||||
|
user="movim"
|
||||||
|
|
||||||
. /lib/lsb/init-functions
|
name=`basename $0`
|
||||||
|
pid_file="/var/run/$name.pid"
|
||||||
|
stdout_log="/var/log/$name.log"
|
||||||
|
stderr_log="/var/log/$name.err"
|
||||||
|
|
||||||
NAME=movim
|
get_pid() {
|
||||||
DESC="Movim PHP Daemon"
|
cat "$pid_file"
|
||||||
MOVIMPID=/var/run/movim.pid
|
}
|
||||||
|
|
||||||
check_status()
|
is_running() {
|
||||||
{
|
[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
|
||||||
if [ ! -r "$MOVIMPID" ]; then
|
|
||||||
test "$1" != -v || echo "$NAME is not running."
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
if read pid < "$MOVIMPID" && ps -p "$pid" > /dev/null 2>&1; then
|
|
||||||
test "$1" != -v || echo "$NAME is running."
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
test "$1" != -v || echo "$NAME is not running but $MOVIMPID exists."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting $DESC" "$NAME"
|
if is_running; then
|
||||||
start-stop-daemon --start --quiet --pidfile $MOVIMPID \
|
echo "Already started"
|
||||||
--exec /usr/bin/php5 -- YHDIR/daemon.php YHURL YHPORT
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
if check_status -q; then
|
|
||||||
log_end_msg 0
|
|
||||||
else
|
else
|
||||||
log_failure_msg "check syslog for diagnostics."
|
echo "Starting $name"
|
||||||
log_end_msg 1
|
cd "$dir"
|
||||||
|
if [ -z "$user" ]; then
|
||||||
|
sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
|
||||||
|
else
|
||||||
|
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
|
||||||
|
fi
|
||||||
|
echo $! > "$pid_file"
|
||||||
|
if ! is_running; then
|
||||||
|
echo "Unable to start, see $stdout_log and $stderr_log"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
if is_running; then
|
||||||
start-stop-daemon --stop --quiet --pidfile $MOVIMPID
|
echo -n "Stopping $name.."
|
||||||
log_end_msg $?
|
kill `get_pid`
|
||||||
rm -f "$MOVIMPID"
|
for i in {1..10}
|
||||||
|
do
|
||||||
|
if ! is_running; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
if is_running; then
|
||||||
|
echo "Not stopped; may still be shutting down or shutdown may have failed"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Stopped"
|
||||||
|
if [ -f "$pid_file" ]; then
|
||||||
|
rm "$pid_file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Not running"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
restart | force-reload)
|
restart)
|
||||||
test_config
|
|
||||||
$0 stop
|
$0 stop
|
||||||
sleep 2
|
if is_running; then
|
||||||
|
echo "Unable to stop, will not attempt to start"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
$0 start
|
$0 start
|
||||||
if [ "$?" != "0" ]; then
|
;;
|
||||||
|
status)
|
||||||
|
if is_running; then
|
||||||
|
echo "Running"
|
||||||
|
else
|
||||||
|
echo "Stopped"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
status)
|
|
||||||
echo -n "Status of $DESC: "
|
|
||||||
check_status -v
|
|
||||||
exit "$?"
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart|force-reload|status}"
|
echo "Usage: $0 {start|stop|restart|status}"
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue