Skip to content

Commit

Permalink
updated for daemontools 1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhangui committed Nov 15, 2024
1 parent 6c93240 commit f88ea58
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
55 changes: 25 additions & 30 deletions create_service.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id: create_service.in,v 1.63 2024-11-10 00:53:04+05:30 Cprogrammer Exp mbhangui $
# $Id: create_service.in,v 1.64 2024-11-15 09:26:18+05:30 Cprogrammer Exp mbhangui $
#

check_update_if_diff()
Expand Down Expand Up @@ -306,10 +306,6 @@ add_service()
echo ""
echo "exec 2>&1"
echo
echo "USER=\`cat variables/USER\`"
echo "HOME=\`cat variables/HOME\`"
echo "HOST=\`cat variables/HOST\`"
echo "PORT=\`cat variables/PORT\`"
echo "for i in pistopstart"
echo "do"
echo " if [ -f \$HOME/.pistop/.\$i.nooverwrite ] ; then"
Expand All @@ -327,9 +323,9 @@ add_service()
echo " bash -c \"</dev/tcp/\$HOST/\$PORT\" 2>/dev/null"
echo " if [ \$? -eq 0 ] ; then"
echo " echo \"\$HOST:\$PORT is alive\""
echo " exec /usr/bin/envdir variables sh -c \"\\"
echo " exec /usr/bin/setuidgid \$USER /usr/bin/tcpclient -vDHR \\"
echo " -t \\\$TIMEOUT \$HOST \$PORT @pistoplibexecdir@/pistopclient 2>&1\""
echo " exec /usr/bin/envdir variables /usr/bin/setuidgid \$USER \\"
echo " /usr/bin/tcpclient -vDHR -t \$TIMEOUT \$HOST \$PORT \\"
echo " @pistoplibexecdir@/pistopclient 2>&1"
echo " else"
echo " echo \"\$HOST:\$PORT is down. Sleeping for 30 seconds...\""
echo " sleep 30"
Expand All @@ -342,8 +338,6 @@ add_service()
echo "exec 2>&1"
echo "killall pistopstart"
echo "sleep 1"
echo "USER=\`cat variables/USER\`"
echo "HOME=\`cat variables/HOME\`"
echo "if [ -x \$HOME/.pistop/pistopstart ] ; then"
echo " exec envdir variables env POWER_OFF=\"\" setuidgid \$USER \\"
echo " \$HOME/.pistop/pistopstart stop"
Expand All @@ -364,22 +358,21 @@ add_service()
echo ""
echo "exec 2>&1"
echo ""
echo "exec /usr/bin/envdir variables sh -c \""
echo " @pistoplibexecdir@/backup"
echo " if [ -x $MDRIVE/bin/boot_sound ] ; then"
echo " $MDRIVE/bin/boot_sound >/dev/null 2>&1"
echo " fi"
echo " systemctl status mpd >/dev/null 2>&1"
echo " if [ \$? -ne 0 ] ; then"
echo " systemctl start mpd"
echo " fi"
echo "@pistoplibexecdir@/backup"
echo "if [ -x $MDRIVE/bin/boot_sound ] ; then"
echo " $MDRIVE/bin/boot_sound >/dev/null 2>&1"
echo "fi"
echo "systemctl status mpd >/dev/null 2>&1"
echo "if [ \$? -ne 0 ] ; then"
echo " systemctl start mpd"
echo "fi"
echo ""
echo " @pistoplibexecdir@/host_status \\\"3 0 3:\$(uname -n) PowerOn\\\""
echo "@pistoplibexecdir@/host_status \\\"3 0 3:\$(uname -n) PowerOn\\\""
echo ""
echo " exec /usr/bin/tcpserver -vDHRo -l 0 \\"
echo " -c variables/MAXDAEMONS -b \\\$MAXDAEMONS \\"
echo " -u \\\$UID -g \\\$GID \\\$HOST \\\$PORT \\"
echo " @pistoplibexecdir@/pistopserver\""
echo "exec /usr/bin/tcpserver -vDHRo -l 0 \\"
echo " -c variables/MAXDAEMONS -b \$MAXDAEMONS \\"
echo " -u \$UID -g \$GID \$HOST \$PORT \\"
echo "@pistoplibexecdir@/pistopserver"
) > $servicedir/$service_name/run
chmod +x $servicedir/$service_name/run
(
Expand All @@ -395,11 +388,10 @@ add_service()
echo ""
echo "exec 2>&1"
echo
echo "exec /usr/bin/envdir ./variables sh -c \""
echo "exec /usr/bin/softlimit -m \\\$SOFT_MEM -o 1024 \\"
echo " /usr/bin/tcpserver -vHRo -l \\\$LOCALIP \\"
echo " -c ./variables/MAXDAEMONS -C \\\$MAXPERIP -b \\\$MAXDAEMONS \\"
echo " \\\$LOCALIP \\\$PORT /usr/bin/rsync -v --daemon --no-detach --log-file=/dev/fd/2\""
echo "exec /usr/bin/softlimit -m \$SOFT_MEM -o 1024 \\"
echo " /usr/bin/tcpserver -vHRo -l \$LOCALIP \\"
echo " -c ./variables/MAXDAEMONS -C \$MAXPERIP -b \$MAXDAEMONS \\"
echo " \$LOCALIP \$PORT /usr/bin/rsync -v --daemon --no-detach --log-file=/dev/fd/2"
) > $servicedir/$service_name/run
chmod +x $servicedir/$service_name/run
touch $servicedir/$service_name/down
Expand Down Expand Up @@ -573,7 +565,7 @@ notifyfifo=""
prog_args="$0 $*"
SYSTEM=$(uname -s)
MDRIVE=""
RCSID="# \$Id: create_service.in,v 1.63 2024-11-10 00:53:04+05:30 Cprogrammer Exp mbhangui $"
RCSID="# \$Id: create_service.in,v 1.64 2024-11-15 09:26:18+05:30 Cprogrammer Exp mbhangui $"

[ -f /etc/mpd.conf ] && music_dir=$(get_mpd_conf_value music_dir) || music_dir=""
while test $# -gt 0; do
Expand Down Expand Up @@ -660,6 +652,9 @@ while test $# -gt 0; do
done
#
# $Log: create_service.in,v $
# Revision 1.64 2024-11-15 09:26:18+05:30 Cprogrammer
# changes for latest daemontools 1.1.6
#
# Revision 1.63 2024-11-10 00:53:04+05:30 Cprogrammer
# remove POWER_OFF variable during shutdown
#
Expand Down
3 changes: 3 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Release 1.1 Start 30/06/2022 End --/--/----
47. create_services: fixed setting of HOME, USER in shutdown script
- 10/11/2024
48. create_services: remove POWER_OFF variable in shutdown script
- 15/11/2024
49. create_services: use env variables directory in supervise run scripts
(new feature of daemontools 1.1.6)

* Thu Jun 30 2022 18:10:06 IST Manvendra Bhangui <[email protected]> 1.0-1.1%{?dist}
Release 1.0 Start 28/08/2020 End 30/06/2022
Expand Down

0 comments on commit f88ea58

Please sign in to comment.