Cron support?

49 views
Skip to first unread message

Jinwoo Lee

unread,
Jan 24, 2024, 8:10:14 PMJan 24
to chromiu...@chromium.org
I want to run a script daily and a cron job would be a perfect fit for that but CrOS doesn't seem to support cron. Is that correct? If so, why don't we support cron?

I found a utility called "periodic_scheduler", which seems to be what I want, but when I make it invoke my script from an upstart script, I get a "process exited 127" error. I think it's due to selinux policy violations but I'm not sure. If I invoke the same periodic_scheduler command from the command line, it works fine.

Is there a better way to run my script daily?

Thanks,
Jinwoo

Mike Frysinger

unread,
Jan 24, 2024, 8:30:53 PMJan 24
to Jinwoo Lee, chromiu...@chromium.org
our needs have not been significant enough to really warrant a dedicated cron daemon and its complexities.

use periodic_scheduler for this.
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
https://groups.google.com/a/chromium.org/group/chromium-os-dev

Jinwoo Lee

unread,
Jan 24, 2024, 8:40:57 PMJan 24
to Mike Frysinger, chromiu...@chromium.org
Thank you, Mike. I tried to use periodic_scheduler but encountered an issue that I mentioned above. Does periodic_scheduler require selinux configurations?

Mike Frysinger

unread,
Jan 24, 2024, 8:49:40 PMJan 24
to Jinwoo Lee, chromiu...@chromium.org
not sure where you're seeing that error message, but if you look at dmesg/syslog, it would tell you if there was an selinux violation
-mike

Luigi Semenzato

unread,
Jan 24, 2024, 8:53:26 PMJan 24
to ChromiumOS Development, Jinwoo Lee, chromiu...@chromium.org, Mike Frysinger
If periodic_scheduler needs a selinux configuration, can such configuration be kept separate from the ChromeOS-proper selinux config?  And if not (or if it's too difficult), would the CrOS team mind having entries for services that are only present in ChromeOS spin-offs?

Jinwoo Lee

unread,
Jan 25, 2024, 1:04:52 PMJan 25
to Luigi Semenzato, ChromiumOS Development, Mike Frysinger
/var/log/audit/audit.log has entries like this (Our script name has been redacted):

type=AVC msg=audit(1706056357.321:14): avc:  denied  { execute } for  pid=2401 comm="periodic_schedu" name="<our_script>.sh" dev="nvme1n1p3" ino=50435 scontext=u:r:cros_periodic_scheduler:s0 tcontext=u:object_r:cros_unconfined_exec:s0 tclass=file permissive=0

So it seems it is indeed due to selinux policy violations. The shell script is our own log cleaner for files stored in /var/log/<our_own_directory>. Because our log file name pattern is quite different from CrOS's log file names, I'm writing our own log cleaner. Do I have to add new selinux rules for this?

Mike Frysinger

unread,
Jan 25, 2024, 4:44:26 PMJan 25
to Jinwoo Lee, Luigi Semenzato, ChromiumOS Development
you can try installing files into /etc/selinux.  maybe it'll work.
-mike

Luigi Semenzato

unread,
Jan 25, 2024, 5:18:07 PMJan 25
to Mike Frysinger, Jinwoo Lee, ChromiumOS Development
Thank you Mike.
Reply all
Reply to author
Forward
0 new messages