Calling xmessage from rc.d/local not working
by Alfred-Augustus from LinuxQuestions.org on (#6GRER)
Can anyone explain why calling xmessage from rc.d/local does not work?
If I just run the following script manually from a terminal, then xmessage works.
I wrote the following to suspend the laptop when the battery level drops below 10%. Just before that, I want to display a pop-up message in front of the monitor.
Thanks!
Code:$ cat /etc/rc.d/rc.local
#!/bin/bash
/etc/rc.d/rc.low-battCode:$ cat /etc/rc.d/rc.low-batt
#!/bin/sh
/home/ala/bin/low-batt &Code:$ cat /home/ala/bin/low-batt
#!/bin/sh
while sleep 60
do
battlev=`cat /sys/class/power_supply/BAT0/capacity`
if test $battlev -lt 10
then
xmessage -geometry 300x200+400+200 -title "Battery" \
-buttons okay:1,quit:0 -default okay \
"Batt level Low - Suspending" &
sleep 5
loginctl suspend
fi
done
If I just run the following script manually from a terminal, then xmessage works.
I wrote the following to suspend the laptop when the battery level drops below 10%. Just before that, I want to display a pop-up message in front of the monitor.
Thanks!
Code:$ cat /etc/rc.d/rc.local
#!/bin/bash
/etc/rc.d/rc.low-battCode:$ cat /etc/rc.d/rc.low-batt
#!/bin/sh
/home/ala/bin/low-batt &Code:$ cat /home/ala/bin/low-batt
#!/bin/sh
while sleep 60
do
battlev=`cat /sys/class/power_supply/BAT0/capacity`
if test $battlev -lt 10
then
xmessage -geometry 300x200+400+200 -title "Battery" \
-buttons okay:1,quit:0 -default okay \
"Batt level Low - Suspending" &
sleep 5
loginctl suspend
fi
done