I have made a simple .sh script which checks every minute whether a particular file is empty or not, and if it is not empty, makes a led on my laptop blink at 0.5Hz.
I call this script from my
Whenever I am in TTY, the thing works flawlessly (to say: when the file is not empty the led on my lappy blinks at that precise frequency).
But when I run X (I use Xmonad/urxvt, invoked via
startx if that could help) something strange happens. The frequency of the blink is erratic, it slows down (a bit) the machine and when I call
top I see various sudo processes (the one I call to turn the led on or off).
It is the same behavior as if I called the script three or four times.
I don't know how to diagnose the problem. The manual says
.bash_profile gets read once (at login time). Can you help me out?
# blink mail led blinkTime="0.2" checkTime="60" while true; do hasIt=$(cat ~/someFolder/hazText.txt) # 1: has text if [ $hasIt -eq "1" ] then echo "1" | sudo tee /sys/class/leds/led:alarm/brightness > /dev/null sleep $blinkTime echo "0" | sudo tee /sys/class/leds/led:alarm/brightness > /dev/null sleep $blinkTime else sleep $checkTime fi done