Comments (2)
You can create a crontab job that runs every day at a specifig time.
Unfortunately we did not implement it in the current setup by default, so you need to do a little bit of work.
- Create an init.d script to run the cron service on startup:
nano /etc/init.d/S90crond
#!/bin/sh
CRON_JOB="30 22 * * * /root/poweroff.sh"
case "$1" in
start)
printf "Starting cron ... "
mkdir -p /var/spool/cron/crontabs
echo "$CRON_JOB" > /var/spool/cron/crontabs/root
start-stop-daemon -S -q -m -b -p /var/run/dcron.pid --exec /usr/sbin/crond -- -f
echo "done."
;;
stop)
printf "Stopping cron ..."
start-stop-daemon -K -q -p /var/run/dcron.pid
echo "done."
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
;;
esac
To make it simple, the cron job definition is also stored in the init script. For crontab scheduler definitions you can look at www.crontabgenerator.com for easily create the desired pattern.
-
Make the init.d script executable:
chmod +x /etc/init.d/S90crond
-
Create the shutdown script:
nano /root/poweroff.sh
#!/bin/sh
poweroff &
exit 1
BTW: Putting the script into the root folder may not the best choice, but we leave it for now.
-
Make the shutdown script executable:
chmod +x /root/poweroff.sh
-
Reboot your system.
Ensure to have the system time set correctly (e.g. internet sync) - else you have to setup the cron job with a delta t.
from buildroot-webkit.
Thanks for providing such fine details. From the information I gleaned from the web, it seems that I shouldn't really need to shutdown the RPi so I didn't use your script. I'm sure it would have done a great job.
Thanks again.
from buildroot-webkit.
Related Issues (20)
- Change the boot screen HOT 3
- How Can I change boot splashscreen HOT 1
- 2022 HOT 1
- 2022 HOT 4
- Magic Mirror HOT 4
- 2022
- Custom boot image HOT 8
- Browser refresh HOT 2
- Cron job HOT 3
- i get this error when i am compiling HOT 2
- Custom Splash Image. HOT 1
- GPIO LCD Driver Support HOT 3
- RPI Zero 2W Support HOT 3
- RPI2 HOT 5
- Wifi connection required for webserver HOT 6
- Read-only filesystem for RPi3? HOT 4
- Rotate display HOT 3
- Auto refresh web page
- only keyboard is working HOT 4
- Custom Boot Logo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildroot-webkit.