You are not logged in.

#1 2019-09-08 14:27:15

regor
Member
Registered: 2019-09-08
Posts: 3

[SOLVED] startup cron job not able to connect to the internet

So I have this script scheduled to run at @reboot with cron. It is only supposed to run "pacman -Syu" and log the output. The problem is that the network interface does not appear to be up at this moment, even if it is when I log in. The script works when I use netctl to start my interface at the beginning of the script.

I suppose this is because cron jobs are executed before my interface is brought up. If it is indeed the case, is there a way to change this ?

Last edited by regor (2019-09-08 16:00:27)

Offline

#2 2019-09-08 14:36:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] startup cron job not able to connect to the internet

regor wrote:

So I have this script scheduled to run at @reboot with cron.

You'd be far better off with a systemd service, especially given that you need to depend on the network.

regor wrote:

It is only supposed to run "pacman -Syu" and log the output.

This, however, is a horrible idea no matter how you start it.  Updates should not be unattended, and occasionally require user intervention or response to a prompt.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-09-08 14:50:42

regor
Member
Registered: 2019-09-08
Posts: 3

Re: [SOLVED] startup cron job not able to connect to the internet

Yes, I would not normally do this, but in this case I need to as part of a school assignment. I have to write a script to update the system that automatically starts at boot and at an other arbitrary time.

I am going to try with systemd, and see if I can get something cleaner than this. Thank you for the fast answer.

EDIT: Problem solved with systemd.

Last edited by regor (2019-09-08 15:57:55)

Offline

#4 2019-09-09 03:44:31

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,770

Re: [SOLVED] startup cron job not able to connect to the internet

regor,

In the future, please do us (and you) a favor.  If you are working on an academic assignment, you are obligated to tell us up front.  You will still get answers, and they will be answers; but it will allow us to tailor our responses to guide you, with no one being placed in the position of compromising academic ethics.

Edit:  In no way implying that such a breach has occurred here.  Just give us a heads-up.

Last edited by ewaller (2019-09-09 03:45:30)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB