Skip to content

Instantly share code, notes, and snippets.

@tserong
Created July 1, 2022 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tserong/3ba2cdeae3fe2d9ac69b0d076d14febc to your computer and use it in GitHub Desktop.
Save tserong/3ba2cdeae3fe2d9ac69b0d076d14febc to your computer and use it in GitHub Desktop.
/data/rc.local script for Victron Cerbo GX to install custom crontab entry to run /home/root/sched.py
#!/bin/sh
if ! grep -q 'sched\.py' /etc/crontab; then
mount | grep -q 'on / .*ro'
is_ro=$?
if [ $is_ro -eq 0 ]; then
mount -o remount,rw /
fi
cat >> /etc/crontab <<EOF
# Set scheduled charges based on zcell maintenance cycle
0 21 * * * root TZ=\$(dbus -y com.victronenergy.settings /Settings/System/TimeZone GetValue | tr -d "'") /home/root/sched.py 10.1.1.133
EOF
if [ $is_ro -eq 0 ]; then
mount -o remount,ro /
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment