ROBIN -  Open Source Mesh Network Forum Index ROBIN - Open Source Mesh Network
users community forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

New CRON entry

 
Post new topic   Reply to topic    ROBIN - Open Source Mesh Network Forum Index -> Robin_beta-1.6 (r3xxx)
View previous topic :: View next topic  
Author Message
Ads






Posted: Tue Jul 17, 2018 10:41 am    Post subject: Ads

Back to top
karlos
Skilled User
Skilled User


Joined: 22 Aug 2008
Posts: 167

PostPosted: Thu Nov 22, 2012 7:33 am    Post subject: New CRON entry Reply with quote

Guys I have scoured the forum ... the only solution found is for old firmware.

How (WHERE) do I add a cron job that survives a re boot?
Back to top
View user's profile Send private message
westbywest
Power User
Power User


Joined: 16 Dec 2008
Posts: 320
Location: St. Louis, MO USA

PostPosted: Wed Nov 28, 2012 5:23 pm    Post subject: Reply with quote

My approach to this is a crafty custom.sh that inserts a new cron entry (in this case daily reboot) upon recently rebooted node's first checkin. Basically, it is a big case statement that executes a particular routine based on the node's 5.X.X.X IP address. This lets me specify different cron jobs per node (e.g. staggered reboot times).

Code:


#!/bin/sh
#Reboot specific nodes, identified by IP
NODE_IP=$(uci get node.general.IP_mesh)
case $NODE_IP in
        '5.X.Y.Z')
                rm -f /etc/update/custom.md5
                if (! grep reboot /etc/crontabs/root )
                then
                        echo "55        9       *       *       * /sbin/reboot ">> /etc/crontabs/root
                fi
        ;;
        '5.A.B.C')
                rm -f /etc/update/custom.md5
                if (! grep reboot /etc/crontabs/root )
                then
                        echo "45        4       *       *       * /sbin/reboot ">> /etc/crontabs/root
                fi
        ;;

esac
exit 0
#
Back to top
View user's profile Send private message Visit poster's website
karlos
Skilled User
Skilled User


Joined: 22 Aug 2008
Posts: 167

PostPosted: Thu Nov 29, 2012 1:49 am    Post subject: Reply with quote

Cool, thanks for that, I was starting to see that custom.sh was the way to go.
Back to top
View user's profile Send private message
Antonio (isleman)
Site Admin
Site Admin


Joined: 10 Feb 2008
Posts: 2323
Location: Toscana, Italy

PostPosted: Thu Nov 29, 2012 9:18 pm    Post subject: Reply with quote

you can add a new cron job script as a 'plugin' into directory /lib/robin/jobs and add it's name to the pligin list file.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karlos
Skilled User
Skilled User


Joined: 22 Aug 2008
Posts: 167

PostPosted: Thu Nov 29, 2012 11:53 pm    Post subject: Reply with quote

argh thank you sir, There had to be a way Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ROBIN - Open Source Mesh Network Forum Index -> Robin_beta-1.6 (r3xxx) All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
c d
e



Powered by phpBB © 2001, 2005 phpBB Group

Abuse - Report Abuse - TOS & Privacy.
Powered by forumup.it free forum, create your free forum! Created by Hyarbor & Qooqoa
Confirmed

Page generation time: 0.06