Before updating to Catalina (10.15.1) my agent based on a bash script was working perfectly.
I had set the agent in order to execute the bash script on boot. Here is the plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mark.battery.info</string>
<key>Program</key>
<string>/Users/mark/Dropbox/Exec/BatteryInfoOnBoot.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
After the last update I noticed that the script (BatteryInfoOnBoot.sh) was no longer loaded at boot and if I execute the command:
launchctl list | grep mark
- 1 mark.battery.info
I read that the status 1 means:
PID - Status 1 means that the process doesn't have enough privileges to access some files
The script BatteryInfoOnBoot is very simple:
#!/bin/bash
echo "~~~~~~~~~" >> /Users/mark/Documents/battery-log.txt
date >> /Users/mark/Documents/battery-log.txt
/Users/mark/Dropbox/Exec/BatteryInfo.sh >> /Users/mark/Documents/battery-log.txt
instead BatteryInfo.sh is used only to get some useful info:
#!/bin/bash
echo "Current battery percentage:"
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
echo ""
echo "Cycle count:"
system_profiler SPPowerDataType | grep "Cycle Count"
echo ""
echo "Capacity stats:"
ioreg -brc AppleSmartBattery | grep -i capacity | grep -v Legacy | grep -v BatteryData | grep -v AppleRaw
echo ""
PS: the script is still working if I exec it manually:
/Users/mark/Dropbox/Exec/BatteryInfoOnBoot.sh
Any suggestions?