The officially official Devuan Forum!

You are not logged in.

#1 2023-02-28 19:01:45

zapper
Member
Registered: 2017-05-29
Posts: 967  

Regarding making cronie jobs,

I wanted to know how to do so and also, how to do so with command line arguments.

Like this for example:

xset dpms noblank on

ONLY, added to whatever crontab I want.

The one I actually want added is this though, for root:

tblock -Syu

Aka, I want tblock to update my /etc/hosts every time I log in and after that, every hour.

Thoughts?


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

#2 2023-03-01 15:46:16

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: Regarding making cronie jobs,

For every hour, you could put a script in /etc/cron.hourly.
For running something upon login, you would probably put it in some file that gets sourced at login or in your desktop's startup apps. (e.g. .bashrc, .profile, .xsettings, or other. I'm not sure what's most appropriate.)
For running something when you boot up, you could put commands in /etc/rc.local.

Offline

#3 2023-03-03 07:19:05

zapper
Member
Registered: 2017-05-29
Posts: 967  

Re: Regarding making cronie jobs,

fsmithred wrote:

For every hour, you could put a script in /etc/cron.hourly.
For running something upon login, you would probably put it in some file that gets sourced at login or in your desktop's startup apps. (e.g. .bashrc, .profile, .xsettings, or other. I'm not sure what's most appropriate.)
For running something when you boot up, you could put commands in /etc/rc.local.

Would it have root permissions? If so, that would suffice.


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

#4 2023-03-03 12:53:49

fsmithred
Administrator
Registered: 2016-11-25
Posts: 2,486  

Re: Regarding making cronie jobs,

The scripts in /etc/cron.* and /etc/rc.local will run as root. Any that you set in your desktop startup apps will run as your user.

Offline

#5 2023-03-04 00:25:50

zapper
Member
Registered: 2017-05-29
Posts: 967  

Re: Regarding making cronie jobs,

fsmithred wrote:

The scripts in /etc/cron.* and /etc/rc.local will run as root. Any that you set in your desktop startup apps will run as your user.

Hmm... okay, just one thing comes to mind though, how would this work in openrc?

I cannot find /etc/rc.local and I am not completely sure what a script is supposed to look like when it is set  to do a command.

I ask because, isn't /etc/rc.local a sysvinit function?


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

#6 2023-03-04 00:51:08

golinux
Administrator
Registered: 2016-11-25
Posts: 3,318  

Re: Regarding making cronie jobs,

zapper wrote:

I ask because, isn't /etc/rc.local a sysvinit function?

IIRC, openrc uses the sysvinit scripts.

Offline

#7 2023-03-04 00:55:22

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,253  

Re: Regarding making cronie jobs,

/etc/rc.local belongs to initscripts which according to its dependencies are used the same in sysv-rc | file-rc | openrc.

So, no, it's not a sysvinit function.

I suppose there is always the question of which belongs to what, and in particular, which part of the OS belongs to "the init system". When asked, different people answers different things about that. Perhaps the most strict view about sysvinit would be to say that it consists only of the binaries of sysvinit-core and the configuration file /etc/inittab, and then anything below that is "run control", start up code or daemons.

And then perhaps an opposite "init is everything" may also be peddled, as well as any concept granularity in between.

Offline

#8 2023-03-04 02:16:38

golinux
Administrator
Registered: 2016-11-25
Posts: 3,318  

Re: Regarding making cronie jobs,

Now there's an answer!

Offline

#9 2023-03-06 23:20:09

zapper
Member
Registered: 2017-05-29
Posts: 967  

Re: Regarding making cronie jobs,

ralph.ronnquist wrote:

/etc/rc.local belongs to initscripts which according to its dependencies are used the same in sysv-rc | file-rc | openrc.

So, no, it's not a sysvinit function.

I suppose there is always the question of which belongs to what, and in particular, which part of the OS belongs to "the init system". When asked, different people answers different things about that. Perhaps the most strict view about sysvinit would be to say that it consists only of the binaries of sysvinit-core and the configuration file /etc/inittab, and then anything below that is "run control", start up code or daemons.

And then perhaps an opposite "init is everything" may also be peddled, as well as any concept granularity in between.

Hmm... the peculiar thing is... I don't have an rc.local.

I have something like this:

a readme is here:
  /usr/share/openrc/support/sysvinit/README.md               
says the below:

Here's a sample inittab for use with sysvinit for Linux based systems.
We don't install it by default as sysvinit packages normally own this file.

Anywho, isn't there an example of what it is supposed to look like when it is being used?

I suppose I could check other unixlike systems to see what they look like when cron is being used.


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

#10 2023-03-07 01:25:04

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,253  

Re: Regarding making cronie jobs,

/etc/rc.local is an executable script (or program) that gets exec'd by e.g.,  the /etc/init.d/rc.local startup script.

/etc/inittab is a configuration file for sysvinit's init program, and it is not a script, but rather a series of service declarations that are interpreted by /sbin/init. When man pages were a thing you would have "man inittab" as way of finding out its syntax.

Offline

#11 2023-03-07 03:31:44

zapper
Member
Registered: 2017-05-29
Posts: 967  

Re: Regarding making cronie jobs,

ralph.ronnquist wrote:

/etc/rc.local is an executable script (or program) that gets exec'd by e.g.,  the /etc/init.d/rc.local startup script.

/etc/inittab is a configuration file for sysvinit's init program, and it is not a script, but rather a series of service declarations that are interpreted by /sbin/init. When man pages were a thing you would have "man inittab" as way of finding out its syntax.

Hmm.. if I understand then correctly, all I need to do is put it in the hourly folder and set it up like a cron file and it should work, right?

wanting to make a system type one where you add parameters at the end as I said above, I think?

tblock -Syu


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

#12 2023-03-07 04:38:50

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,253  

Re: Regarding making cronie jobs,

Possibly yes; cron typically executes scripts and programs in /etc/cron.hourly according to the line saying so in /etc/crontab.

See also the note about PATH in man 5 crontab.

Offline

#13 2023-03-19 20:11:40

zapper
Member
Registered: 2017-05-29
Posts: 967  

Re: Regarding making cronie jobs,

ralph.ronnquist wrote:

Possibly yes; cron typically executes scripts and programs in /etc/cron.hourly according to the line saying so in /etc/crontab.

See also the note about PATH in man 5 crontab.

Couldn't figure out how to start this, dunno why.

*sigh*

But no worries, the developer of tblock actually is trying to debloat his package so it won't slow everything down to a crawl.

big_smile


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD
Peace Be With us All!

Offline

Board footer