Skip to content

cron is filling my journal.

Installed cron (because it's what I'm used to. Timers.... not too interested in). I'm running a job every minute to grab some images from my local-only camera server to make them available on my web server that's accessible from the outside world. This setup is working perfectly for me but I am getting too many journal entries. How to stop cron from logging in the journal?

3 points12 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 100% up
Kind
Text
ID
45c3yi

Author

4
posts
37
comments
1
media
View profile

12 comments

> /dev/null 2>&1

?

3 points

It was also emailing me every time (in the beginning) so I added what you've mentioned :

*/1 * * * * /home/user/Apps/getcams.sh &>/dev/null

Now it stopped emailing me but I get this every minute in my journal :

Feb 11 17:57:02 fury-1 CROND[4417]: pam_unix(crond:session): session closed for user root

Feb 11 17:57:01 fury-1 CROND[4418]: (root) CMD (/home/user/Apps/getcams.sh &>/dev/null)

Feb 11 17:57:01 fury-1 crond[4417]: pam_unix(crond:session): session opened for user root by (uid=0)

Yes I am running the job as root, so I don't have to think about permissions here. This was the simplest way I could think of to wget some files over to /srv/http.

2 points

I have a script that runs sudo iwconfig and outputs various wifi info, which I run every 3s and pipe to my status bar (xmobar), so every 3s, I see

Feb 11 20:10:30 arch sudo[30549]:    brian : TTY=unknown ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/iwconfig wlp1s0
Feb 11 20:10:30 arch sudo[30549]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 11 20:10:30 arch sudo[30549]: pam_unix(sudo:session): session closed for user root

when I run journalctl -f.

I'd be interested to see if anyone knows how to exclude such events from the journal, because I don't know how to.

2 points

Using cron to run a shell script every second is abuse of cron IMO.

Just run the script with a loop that calls sleep 1. Create a service file for it and let systemd run it for you.

2 points

It was only running every minute, but still.. you're right. In the end I've done what you suggested, a script with a while true loop and sleep 60 running in a service. I found I had to put StandardOutput=null in the service file to get it to shut up, still.

2 points

Seconds, minutes, what's the difference? :)
My reading comprehension is proportional to my caffeine intake, apparently.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.