I have cloned a git repository of some project. I want to automate git pull and compile the project once in a week. I am using a laptop which wont be on 24x7.
Now, I cannot use cron as I should keep the system running at that exact moment. I cannot use anacron too as it might start before I connect to network.
Is there some option in anacron that will run this particular job only when I am connected to internet? Or should I be using some other different tool for this?
|
|
|||||||||||||||||
|
|
Run the job when you connect to the network. Most distributions have a scripting infrastructure that you can plug into, though you will need root permissions. If you connect with NetworkManager or Wicd, they have their own hook infrastructure as well. Add a cron job that only runs if the network is available (and, optionally, only if the job hasn't been run performed in a long time), in case the network remains connected for a long time. You don't specify your distribution, so I'll give an example for a Debian-based distribution. The scripts in
with a
And a crontab entry on your account:
|
|||
|
|
|
Use Here's an example script that will get you close:
|
|||
|
|
