That is how I use it all the time.
E.g. wait 6 minutes for the tea to be ready:
Code: Select all
sleep 6m;alarm.sh 5
That is how I use it all the time.
Code: Select all
sleep 6m;alarm.sh 5
Code: Select all
alarm.sh 5;sleep 20m;alarm.sh 5;sleep 20m;alarm.sh 5
Since alarm is a loop it will sound its file every 5 seconds when told to, so if you are anywhere near the speakers it can be hardly missed (unless the speakers are off or set to a too low volume)Ed_P wrote: ↑03 Feb 2022, 17:54I'm thinking more:where I am outside when the disk copy finishes and miss the 1st alarmCode: Select all
alarm.sh 5;sleep 20m;alarm.sh 5;sleep 20m;alarm.sh 5
Code: Select all
sleep 20m;beep;sleep 20m;beep
Code: Select all
sleep 20m;beep;sleep 5;beep;sleep 20m;beep;sleep 5;beep
Yes, kinda. I do like alarm.sh's 2 beeps verses a single one so your second example is more to my liking. Alarm.sh is indeed more like an alarm clock and repeats constantly. My mind is more around an alert type of sound to indicate that a process has finished and a reminder if the alert is missed. Like when you tell someone to do something and then check back every so often to check that it was done.Rava wrote: ↑03 Feb 2022, 21:07What you meant is probably this:
Code: Select all
sleep 20m;beep;sleep 20m;beep
But what is the issue when alarm.sh just repeats constantly?
Code: Select all
notify-send -i info -t 0 "Encoding" "finished"
Code: Select all
su guest -c 'notify-send -i info -t 0 "Encoding" "finished"'
You are good Rava. I like this idea. Maybe a beep and a notify script would be best.Rava wrote: ↑04 Feb 2022, 10:01But when you want a simple reminder you can use notify-send instead:
as guestas rootCode: Select all
notify-send -i info -t 0 "Encoding" "finished"
Hard to miss a popup on the screen that will not vanish unless you click it.Code: Select all
su guest -c 'notify-send -i info -t 0 "Encoding" "finished"'
When the oven is set to a temperature and I am watching something on tv it beeps, one time, to alert me it has reached the set temp. Not constantly like an alarm clock. If I'm watching a football game and my team is moving, I may ignore the beep, or not hear it if I'm yelling at the tv, in which case a reminder beep would be nice. Same thing with a disk to disk copy or a backup or a download. Important to know when they end but not as important as getting up for breakfast.
You can check if a variable is set.
Code: Select all
-x
Mark names for export to subsequent commands via the environment.
Code: Select all
guest@porteus:~$ pwd
/home/guest
Try
Code: Select all
$PWD
Depends, man pages are known to be so minimal at times that they can be called cryptic.Ed_P wrote: ↑08 Feb 2022, 19:06man bash and -x not as much help as https://www.geeksforgeeks.org/export-co ... -examples/
Indeed they do, especially when you declare a variable as integer you can calculate with it, like i++ in a loop.
Code: Select all
declare -i waitfor_sleep=$1
Code: Select all
root@porteus:/usr/local/bin# waitfor.sh
waitfor.sh V0.9
Waiting $2 seconds for process with the ID of $1 to exit;
This script will exit with exitcode 0;
Other errors are code 2.
waitfor.sh ERROR -- You must specify exact two parameters as shown above.
Code: Select all
root@porteus:/usr/local/bin# waitfor.sh 1000 5;alarm.sh 5
waitfor.sh V0.9
[pid] = 1000 [sleep] = 5 seconds
-
Code: Select all
while kill -0 $searchpid &>/dev/null ; do
if [ $waitfor = "|" ]; then
waitfor="/"
elif [ $waitfor = "/" ]; then
waitfor="-"
elif [ $waitfor = "-" ]; then
waitfor='\'
elif [ $waitfor = '\' ]; then
waitfor="|"
fi
echo -ne '\b'$waitfor
sleep $waitfor_sleep
done
Code: Select all
Other errors are exitcode 2.
Code: Select all
Other errors are code 2.
Code: Select all
#!/bin/bash
# https://forum.porteus.org/viewtopic.php?p=86943#p86943
#set -x;
# http://forum.porteus.org/viewtopic.php?f=53&t=3801&start=30#p28472
BOOT=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
SYSTM=
DRV=${BOOT:5:4}
if [ "$DRV" == "nvme" ]; then
DRV=${BOOT:5:9}
fi
if [ "$DRV" == "isol" ]; then
ISOBOOT=`grep -A1 "//porteus" /var/log/porteus-livedbg|tail -n2|sed 's^//^/^g'`
SYSTM="${ISOBOOT:9:11}/"
DRV=${ISOBOOT:5:4}
if [ "$DRV" == "nvme" ]; then
SYSTM="${ISOBOOT:14:11}/"
DRV=${ISOBOOT:5:9}
fi
fi
echo
echo "BOOT: "$BOOT
echo "ISOBOOT: "$ISOBOOT
echo "SYSTM: "$SYSTM
echo "DRV: "$DRV
echo
echo Finished!
sleep 8
Have you tried exporting it via /etc/rc.d/rc.local ?
Code: Select all
# this being in /etc/rc.d/rc.local
# needs reboot to work
BOOT=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
DRV=${BOOT:5:4}
export DRV
It is indeed, and the waitfor.sh script is helpful, especially combined with alarm.sh at times.
Hardly, it does one check every given seconds, and you can tell it to check only every 5 or only every 100 seconds, depending how much you care about a quick info that the other task is finished.
Code: Select all
ffmpeg WHATEVER […];alarm.sh 5
Code: Select all
guest@porteus:~$ waitfor.sh 0 1
waitfor.sh V0.9
Waiting $2 seconds for process with the ID of $1 to exit;
This script will exit with exitcode 0;
Other errors are code 2.
The wait for time is too low, I set it at a reasonable minimum of 2 seconds.
[pid] = 0 [sleep] = 2 seconds
-
Actually I editted the script to include:
Code: Select all
export DRV
exit
Code: Select all
/home/guest/DRV.sh