Skip to content

Commit

Permalink
updated pstopstart, backup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhangui committed Apr 28, 2024
1 parent 4ba9af4 commit fe9369d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
11 changes: 9 additions & 2 deletions backup.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id: backup.in,v 1.7 2024-03-14 16:34:46+05:30 Cprogrammer Exp mbhangui $
# $Id: backup.in,v 1.8 2024-04-28 12:25:27+05:30 Cprogrammer Exp mbhangui $
#
HOST=$(uname -n)
if [ -z "$DEST" ] ; then
Expand All @@ -23,12 +23,19 @@ if [ -n "$BACKUP" -a -n "$DEST" ] ; then
if [ ! -d $DEST/backup/$HOST"$d" ] ; then
mkdir -p $DEST/backup/$HOST"$d"
fi
rsync -valptgomHE --delete $i $DEST/backup/$HOST"$d"
if [ -n "$RSYNC_OPTIONS" ] ; then
rsync "$RSYNC_OPTIONS" --delete $i $DEST/backup/$HOST"$d"
else
rsync -alptgomHE --delete $i $DEST/backup/$HOST"$d"
fi
done
fi
exit 0
#
# $Log: backup.in,v $
# Revision 1.8 2024-04-28 12:25:27+05:30 Cprogrammer
# added RSYNC_OPTIONS variable to pass options to rsync
#
# Revision 1.7 2024-03-14 16:34:46+05:30 Cprogrammer
# transfer files with original directory into dest
#
Expand Down
29 changes: 16 additions & 13 deletions doc/ChangeLog
Expand Up @@ -5,10 +5,10 @@ Release 1.1 Start 30/06/2022 End --/--/----
02. create_service: pass -n "" for fclient to use un-encrypted channel
03. pistop.spec, debian/postinst: fix variables/.options for refreshsvc
- 12/07/2022
04. pistopstart: start systemd sound.service on startup
04. pistopstart.in: start systemd sound.service on startup
05. create_service: create MDRIVE variable for fclient, fserver
- 13/07/2022
06. pistopstart: fixed power off
06. pistopstart.in: fixed power off
07. create_service: added /sbin, /usr/sbin to PATH for shutdown to work
08. create_service: modified /service/fclient/shutdown to run without
POWER_OFF env variable
Expand All @@ -18,29 +18,29 @@ Release 1.1 Start 30/06/2022 End --/--/----
- 27/07/2022
11. create_service.in: updated for change in tcpserver -n option
- 03/05/2023
12. pistopstart: removed hardcoded systemctl path
12. pistopstart.in: removed hardcoded systemctl path
- 18/05/2023
13. pistopstart: increased sleep duration if disk mount fails
13. pistopstart.in: increased sleep duration if disk mount fails
14. pistop.spec: updated SPEC file
15. create_service: kill pistopstart script if running in shutdown
- 26/06/2023
16. pistopstart: Use MDRIVE from variables if not from /etc/mpd.conf
16. pistopstart.in: Use MDRIVE from variables if not from /etc/mpd.conf
- 28/06/2023
17. pistopserver.c: display IP addresses
18. pistopclient.c: added more info messages
19. pistopstart: send startup/shutdown text to lcdhost running lcdDaemon from
19. pistopstart.in: send startup/shutdown text to lcdhost running lcdDaemon from
lcd-daemon package
20. create_service: execute $HOME/.pistop/pistopstart in shutdown script
21. pistopstart: use /proc/loadavg instead of uptime command
22. pistopstart: use timeout for nc command
21. pistopstart.in: use /proc/loadavg instead of uptime command
22. pistopstart.in: use timeout for nc command
- 29/06/2023
23. pistopstart: use LCD_HOST if defined instead of lcdhost from /etc/hosts
23. pistopstart.in: use LCD_HOST if defined instead of lcdhost from /etc/hosts
24. create_service: added --lcdhost, --lcdport to create LCD_HOST, LCD_PORT
env variables
- 30/06/2023
25. create_service: added --lcdfifo to create LCD_FIFO env variable
26. host_status: script to send text to LCD display
27. pistopstart: use host_status to send text to LCD display
27. pistopstart.in: use host_status to send text to LCD display
28. pistopserver.c: fixed shutdown
- 04/07/2023
29. pistopstart.in: Use umount -f -l to prevent hanging
Expand All @@ -51,18 +51,21 @@ Release 1.1 Start 30/06/2022 End --/--/----
32. pistopstart.in, create_services: modified for config witout mpd
- 21/03/2024
33. create_services: Create FORCE_UMOUNT env variable
34. pistopstart: Display umount method in log
34. pistopstart.in: Display umount method in log
- 23/03/2024
34. host_status.in: add delay when resetting LCD display
35. host_status.in: eliminate duplicate ip addresses
- 27/03/2024
36. pistopstart: umount MDrive without triggering autofs
37. pistopstart: ignore sigpipe
36. pistopstart.in: umount MDrive without triggering autofs
37. pistopstart.in: ignore sigpipe
- 21/04/2024
38. create_services.in, host_status.in: added desktop notification to
notifyhost or notify-fifo
39. pistopstart.in: send PowerOff, MusicOff notification as desktop
notification
- 28/04/2024
40. backup.in: added RSYNC_OPTIONS variable to pass options to rsync
41. pistopstart.in: added more info statements

* Thu Jun 30 2022 18:10:06 IST Manvendra Bhangui <pistop@indimail.org> 1.0-1.1%{?dist}
Release 1.0 Start 28/08/2020 End 30/06/2022
Expand Down
22 changes: 17 additions & 5 deletions pistopstart.in
@@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id: pistopstart.in,v 1.17 2024-04-21 23:12:32+05:30 Cprogrammer Exp mbhangui $
# $Id: pistopstart.in,v 1.18 2024-04-28 12:32:14+05:30 Cprogrammer Exp mbhangui $
#

systemctl=$(which systemctl)
Expand Down Expand Up @@ -33,8 +33,10 @@ stop()
do
echo "Stopping mpd.service"
if [ -n $systemctl ] ; then
echo "$systemctl stop mpd.service mpd.socket"
$systemctl stop mpd.service mpd.socket
elif [ -d $servicedir/mpd ] ; then
echo "svc -d $servicedir/mpd"
svc -d $servicedir/mpd
else
break
Expand All @@ -53,11 +55,13 @@ stop()
if [ $count -eq 1 ] ; then
echo "Force Unmounting MDrive with lazy option"
fi
[ $count -eq 1 ] && echo "umount -f -l $MDRIVE"
umount -f -l $MDRIVE >/dev/null 2>&1
else
if [ $count -eq 1 ] ; then
echo "Force Unmounting MDrive"
fi
[ $count -eq 1 ] && echo "umount -f -l $MDRIVE"
umount -f $MDRIVE >/dev/null 2>&1
fi
if [ $? -eq 0 -o $count -eq 60 ] ; then
Expand All @@ -81,7 +85,7 @@ stop()
if [ -x $systemctl ] ; then
while true
do
echo "Stopping autofs.service"
echo "$systemctl stop autofs.service"
$systemctl stop autofs.service
if [ $? -eq 0 ] ; then
echo "stopped autofs"
Expand Down Expand Up @@ -117,11 +121,12 @@ start_mpd()
{
mpd_up=0
if [ -x $systemctl ] ; then
echo "$systemctl status mpd.service"
$systemctl status mpd.service >/dev/null 2>&1
if [ $? -ne 0 ] ; then
# trigger autofs to mount MDrive
mpd_was_down=1
echo "starting music player daemon"
echo "$systemctl start mpd.service"
$systemctl start mpd.service
else
mpd_up=1
Expand Down Expand Up @@ -151,8 +156,11 @@ start_mpd()
give_up()
{
echo "Giving up..."
echo "svc -dx /service/fclient"
svc -dx /service/fclient
echo "$systemctl stop autofs"
$systemctl stop autofs
echo "umount $MDRIVE"
umount $MDRIVE
}

Expand All @@ -178,7 +186,7 @@ start()
fi
count=`expr $count + 1`
autofs_was_down=1
echo "starting automount filesystems"
echo "$systemctl start autofs.service"
$systemctl start autofs.service
sleep 1
continue
Expand Down Expand Up @@ -212,7 +220,7 @@ start()
count=`expr $count + 1`
done
@pistoplibexecdir@/host_status load
[ -x $MDRIVE/bin/boot_sound ] && $MDRIVE/bin/boot_sound >/dev/null 2>&1
[ -x $MDRIVE/bin/boot_sound ] && $MDRIVE/bin/boot_sound 2>/dev/null
if [ -n "DEST" -a -n "$BACKUP" -a -d $MDRIVE/backup ] ; then
echo "backing up configuraton"
@pistoplibexecdir@/backup
Expand All @@ -223,6 +231,7 @@ start()
if [ $? -eq 0 ] ; then
line=$(systemctl list-units --all sound.service|sed -n 2p)
if [ "$2" != "loaded" ] ; then
echo "$systemctl start sound.service"
$systemctl start sound.service
fi
else
Expand Down Expand Up @@ -278,6 +287,9 @@ esac

#
# $Log: pistopstart.in,v $
# Revision 1.18 2024-04-28 12:32:14+05:30 Cprogrammer
# added more info statements
#
# Revision 1.17 2024-04-21 23:12:32+05:30 Cprogrammer
# send PowerOff, MusicOff notification as desktop notification
#
Expand Down

0 comments on commit fe9369d

Please sign in to comment.