Öncelikle merhaba,
Kullandığım dağıtım arch linux pencere yöneticisi olarak awesome wm kullanıyorum.Crontab ile bataryanın durumuna göre şarjı tak şarjı çıkar bildirimi gönderen küçük basit bir script yazdım.Crontab ile bu scripti 1 dakikada bir çalıştırmak istiyorum ama çalıştıramadım konu hakkında bilgisi olan yardımcı olursa sevinirim.İyi çalışmalar.
systemctl status cronie.service
● cronie.service - Periodic Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2019-06-14 15:29:02 UTC; 2h 27min ago
Main PID: 24686 (crond)
Tasks: 1 (limit: 4915)
Memory: 3.3M
CGroup: /system.slice/cronie.service
└─24686 /usr/bin/crond -n
Jun 14 17:53:01 Arch CROND[27004]: pam_unix(crond:session): session closed for user abdux
Jun 14 17:54:01 Arch crond[27083]: pam_unix(crond:session): session opened for user abdux by (uid=0)
Jun 14 17:54:01 Arch CROND[27084]: (abdux) CMD (/home/abdux/ex.sh)
Jun 14 17:54:01 Arch CROND[27083]: pam_unix(crond:session): session closed for user abdux
Jun 14 17:55:01 Arch crond[27104]: pam_unix(crond:session): session opened for user abdux by (uid=0)
Jun 14 17:55:01 Arch CROND[27105]: (abdux) CMD (/home/abdux/ex.sh)
Jun 14 17:55:01 Arch CROND[27104]: pam_unix(crond:session): session closed for user abdux
Jun 14 17:56:01 Arch crond[27122]: pam_unix(crond:session): session opened for user abdux by (uid=0)
Jun 14 17:56:01 Arch CROND[27123]: (abdux) CMD (/home/abdux/ex.sh)
Jun 14 17:56:01 Arch CROND[27122]: pam_unix(crond:session): session closed for user abdux
cat /var/spool/cron/abdux
* * * * * /home/abdux/ex.sh
$ cat ex.sh
#!/bin/bash
capacity="/sys/class/power_supply/BAT0/capacity"
AC="/sys/class/power_supply/BAT0/status"
while read line; do
str=$line
done < $capacity
while read a; do
isac=$a
done < $AC
if [ $str -lt 30 ] && [ $isac == 'Discharging' ]
then
`notify-send "Plug in AC YOUR CHARGE IS $str"`
`paplay ~/.batteryeffect/pluginsound.ogg`
elif [ $str -gt 80 ] && [ $isac == 'Charging' ]
then
`notify-send "Unplug in AC YOUR CHARGE IS $str"`
`paplay ~/.batteryeffect/unplugsound.ogg`
fi