Questions tagged [cron]

Cron is a time-based job scheduler found in most Unix-like computer operating systems, like macOS. Cron is driven by a crontab (cron table) file, a configuration file that specifies commands to run periodically on a given schedule. This tag should be use when dealing with any cron issues.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

FFMPEG image capture only executes partially on cron

I have the following shell script: DailyScript.sh #!/bin/sh now="/Users/mydir/Downloads/LIDOPRO/Captures/$(date +'%Y_%m_%d_%I_%M_%p').jpg" "/Users/mydir/Downloads/LIDOPRO/ffmpeg" -...
user avatar
0 votes
1 answer
45 views

I need help translating this cron job into launchd

How do achieve the following cron job into launchd xml format?: * * * * * date > /Users/mariano/cron_test.log I've been trying in several ways, but I don't seem to be getting the ProgramArguments ...
user avatar
0 votes
0 answers
16 views

Grant cron permission for Calendar access

A script in one of my cron jobs needs to access my Calendar, but in order to grant this permission I would need to add cron in the following list: As you can see from the window, I experimented a ...
user avatar
0 votes
0 answers
20 views

Open GUI App after reboot with cron

I'm using Mac OS Catalina 10.15.7 and I'd like to open some apps after boot with a cron tab. I use the following cron tab: @reboot /bin/bash /Users/x/script.sh if I run the script, it works as I want ...
user avatar
  • 175
1 vote
1 answer
86 views

under macos 10.15.7, why cannot cron find files on my external hard drive? [duplicate]

I purchased an external hard drive for scheduled backups of my macbook pro, presumably under cron. My rsync commands work fine when I invoke on the bash (interactive) command line. But as soon as I ...
user avatar
0 votes
2 answers
142 views

Cron job can't access Documents - "Tar: Desktop: Couldn't visit directory: Unknown error: -1"

I have an automated backup script that runs from a cron job. It basically tars up my home directory and pipes it to a command that writes the tarball to Amazon S3. tar zcvf - -X BACKUP_EXCLUDE | /usr/...
user avatar
0 votes
1 answer
81 views

Using tar on crontab causes it to use multiple processes which consume all cpu

The following line is the only line in crontab: * 13 * * * sh /Users/gentaliaru/Dropbox/work/scripts/backup.sh >/tmp/stdout.log 2>/tmp/stderr.log And the script contents are rm -rf /Volumes/X5/...
user avatar
  • 1
0 votes
1 answer
22 views

AutoSync Time periodically

My Catalina weirdly have drifting time, sometimes 5 minutes, 10 minutes, 19 minutes (in 1-2 hours), today it's drifting 40 minutes (in 4 hours). Is there any brew package/daemon that automatically ...
user avatar
  • 743
1 vote
1 answer
136 views

How to restart Mac Mail.app every night?

I want to restart my Mac Mail.app software every night at 6am (or any time I choose). What is the best way to do this? I DO NOT want to reboot my whole Mac every night, only the Mail.app. TIA. UPDATE ...
user avatar
0 votes
1 answer
1k views

Run Shell Scripts on a Schedule

Is there "a right" way to run shell scripts on a schedule in modern versions of MacOS? My usual go to for this has been using the cron command -- but recent changes make seem like this isn'...
user avatar
1 vote
1 answer
131 views

Where should I put cron jobs?

I have some shell code that I'd like to execute daily using cron. Currently, I have the entire code written as a one-liner, and the 6 variations (each designed to run at different times) are all ...
user avatar
  • 226
3 votes
1 answer
133 views

Difference between wake, poweron, and wakeorpoweron on pmset

I'm trying to use pmset to wake my macbook before a cronjob is scheduled. The documentation says a scheduled event has a type that is "one of sleep, wake, poweron, shutdown, wakeorpoweron". ...
user avatar
1 vote
0 answers
44 views

Using launchd to run script once a day when logged in

I'm in the situation where I would like to run a script only once per day when I open my MacBook. I guess I could have the script note the date it was last run, and have it reject when run on the ...
user avatar
  • 11
0 votes
2 answers
233 views

Why is Cron not running the enable wifi command?

I'm trying to use crontab to schedule the 'enable wifi' command: networksetup -setairportpower en0 on. I've been entering this command in the required format in the cron file, eg.: 05 15 * * * ...
user avatar
  • 1
2 votes
0 answers
1k views

How do you turn on crontab logging on Big Sur?

I am running macOS Big Sur 11.2.1 and have several crontab jobs set up and they work fine, but I want to turn on the logging of all of my crontab jobs. I have read that with the recently releases such ...
user avatar
0 votes
2 answers
256 views

launchd, how to run a command every 3 minutes, during working hours on a weekday?

I know cron and that is fairly simple */3 9-17 * * 1-5 myCommand How does one do the same in launchd?
user avatar
  • 304
2 votes
1 answer
418 views

Write cron script to open and exit application

I'm trying to write a script that opens a brand new instance of safari, displays a webpage for 10 minutes, then quits safari. I think I can follow this Stack Exchange to do steps 1 & 2 of my goal. ...
user avatar
1 vote
1 answer
919 views

crontab Operation not permitted - cron has full disk access

I have seen here various issues about the crontab 'Operation not permitted' issue for Mac OS, but I seem to have a more complex situation on my hands. I have a bash file on the desktop, which I wanna ...
user avatar
0 votes
1 answer
183 views

Cron job cannot find ffprobe/avprobeor ffmpeg/avconv even though its installed

I have a cronjob setup to run "/Users/admin/Scripts/youtubedl.sh" Script: cd "/Users/admin/Music/youtubedl-music" /usr/local/bin/youtube-dl -o "%(title)s.%(ext)s" --...
user avatar
1 vote
1 answer
147 views

"sudo crontab -e" not updating /etc/hosts

In my /etc/hosts file, I have records like this: 127.0.0.1 www.youtube.com To keep me from getting distracted. When I need something on one of the sites I have blocked, I add # to the beginning of ...
user avatar
  • 124
2 votes
1 answer
457 views

How create a crontab on mac?

I'm trying to create a crontab on mac. I've tried crontab -e which takes me to what appears to be an empty file opened with vim. I make no changes and simply press esc, :, w, then q to save and exit. ...
user avatar
  • 2,967
1 vote
1 answer
39 views

Running Cron with an updated Bash version

Is there a way to get cron to run with an updated version of Bash that's been installed? My OS came with Bash 3.x installed stock and I've upgraded it to 5.x with macports. When I query bash --version ...
user avatar
  • 2,400
1 vote
2 answers
120 views

Cronjob macOS does not work if set with a bash external script

I'm trying to create a new cronjob which launches a script every time at startup. If I do cronjob -e and then I insert for example @reboot bash /Users/user/script.sh and then I save everything is fine:...
user avatar
  • 23
2 votes
1 answer
444 views

Crontab -l command working. No other crontab command is working

New to crontab, I wanted to experiment. Running the command crontab -l gave me the following answer crontab: no crontab for User_1 Every time I tried to issue a command like 1 16 24 10 6 ping -D -c 1 ...
user avatar
  • 1,063
1 vote
2 answers
223 views

cron queueing bash and python scripts

I'm currently looking to understand and get comfortable with crontab queues on my macbook pro. I recently solved an issue where my simple bash script would not execute. It turns out I had to move my ...
user avatar
4 votes
2 answers
339 views

cronjobs do not run

I have recently switched from Ubuntu to MacOS. I tried to run the exact same cronjobs I ran on Ubuntu before, however they don't, and after trying to figure out if the crontab entries might have any ...
user avatar
0 votes
0 answers
45 views

Granting cron permission to control Finder

I aim to use cron to call a python script that changes my desktop background. The key python line is as follows: from appscript import mactypes, app app('Finder').desktop_picture.set(mactypes.File(...
user avatar
1 vote
1 answer
2k views

'Operation not permitted' accessing SMB Share as root under Catalina

I have a script that copies a file from our server to the local machine. Here is the script and output + date Thu Jun 11 09:16:00 ACST 2020 + id -un root + pwd /Volumes/Macintosh HD/backups + mkdir /...
user avatar
0 votes
1 answer
53 views

Trying to add cronjob results in ""LICENSE":0: bad minute"

I am trying to set up a cronjob to run every minute with the following command: crontab * * * * * sh /Users/username/Downloads/reddit-notifications-master/notifyer.sh notifyer.sh has the following ...
user avatar
  • 259
0 votes
1 answer
70 views

Issue with "date" command in MacOS Mojave

I think this is a "Full Disk Access" problem. I have added "Terminal" and "cron" to Full Disk Access. The problem is when I am trying to use the command below, it works from Terminal but not with ...
user avatar
  • 21
1 vote
1 answer
1k views

how to automate / run 'brew cask upgrade' as a cron job?

I wish to run brew cask upgrade in a cronjob, but it prompts for a password. When I run the job as root all permissions are screwed up. Howto run that command in a cronjob env? I use zsh. ~ brew ...
user avatar
  • 3,325
0 votes
0 answers
184 views

command silently failing when running from the root's crontab

I have a script that runs diskutil and since diskutil needs permissions to run I'm running the script from the root's crontab. Steps: sudo su root crontab -e sh /test.sh Nothing ever happens ...
user avatar
33 votes
1 answer
15k views

Crontab Operation not permitted

I have the following crontab on my mac OS Catalina 10.15.1 : * * * * * /Users/username/Desktop/cronjob.sh > /Users/username/Desktop/cronjob.log 2>&1 Within the command file is: #!/bin/...
user avatar
  • 565
5 votes
1 answer
2k views

rsync in cron on Catalina no longer working

I have various rsync entries in crontab that worked reliably right up until the moment I upgraded to Catalina. 00 04 * * * /usr/local/bin/rsync --archive /Volumes/FOO me@remote.example:BAR Here ...
user avatar
3 votes
3 answers
3k views

cron lacks permissions to run a script

I have a script (which backs up, using rclone) that I can run from the Terminal or Automator after chmod a+x, with no permissions problems. However, when this script is run in cron (or launchd), ...
user avatar
3 votes
1 answer
181 views

Launch app in foreground doesn't work from cron, but does from terminal

I have the following: * * * * * open -a /Applications/TextWrangler.app/ ~/notes.txt; open /Applications/Notes.app Neither of the 2 apps brings focus to the foreground (though they do get launched ...
user avatar
8 votes
3 answers
2k views

"cron" processes spawning and piling up, but no crontab

EDIT: I solved this, so see below for my own answer. While the bounty asks for a fix to the problem, I'd like to award it to someone who can explain why a cron process that ran for 6 years over ...
user avatar
  • 131
17 votes
1 answer
5k views

On Catalina, how can a cronjob get permission to touch files on a USB disk?

I have a USB disk, that takes ages to spin up after it has gone to sleep. So in the past I used either a cron job to regularly touch a file on it, so it will never spin down. */5 * * * * /usr/bin/...
user avatar
  • 325
10 votes
3 answers
2k views

"cron" processes piling up

I have cronjobs doing various cleanup tasks: $ crontab -l 0 * * * * find ${HOME}/Downloads -depth 1 -d -mtime +12h -exec /usr/local/bin/trash {} \; * * * * * /usr/bin/defaults delete com.apple....
user avatar
1 vote
1 answer
576 views

Shell command works fine as is, but not when executed from crontab. What's the difference?

I created a small workflow with the Automator App, and I want it executed periodically. For that I created an entry in crontab. The problem is that running the workflow straight from the Terminal ...
user avatar
1 vote
1 answer
122 views

File works manually; does not work with cron; setting PATH makes it worse

So I've got these three scrips: one moves pictures to a file (photosscript2.sh), one deletes pictures over 7 days old from that file (photosremove.sh), and one calls both files to keep the folder ...
user avatar
1 vote
1 answer
42 views

Cron job running (?) and output file is being logged every night at 1:35am, but there is nothing listed in crontab -l

I recall creating a cron job that runs a shell script that deletes files that are 45+ days old. When I was editing crontab -e I set it to also output a log to a date stamped log file to ~/Logs. I ...
user avatar
2 votes
0 answers
2k views

How to create a cron log file in macOS High Sierra

I have an issue with cron in macOS High Sierra. I have cron running, and it is running the jobs I want to run. I am unable, however, to figure out how to make it create a cron.log file in /var/log. ...
user avatar
0 votes
0 answers
417 views

tmux + iTerm2 - no permission to edit crontab

I am running macOS 10.14.5, iTerm2 build 3.2.8, tmux 2.9a (tmux -V). I've granted both iTerm2.app and Terminal.app (file permission: .r-xr-xr-x) Full Disk Access (FDP) in Sys prefs > Security and ...
user avatar
  • 1,076
2 votes
2 answers
247 views

What is the best approach to ejecting disk while in sleep mode, scheduled?

So, I have an external HDD which is being used for Time Machine. After getting to home, I usually connect my MacBook to a HDD via Hub and put it into sleep mode. Because I sometimes get back home ...
user avatar
  • 432
1 vote
0 answers
75 views

Change permissions of a folder with cronjob [duplicate]

I have a scanner that can "save to folder" only with FTP or CIFS protocols. I managed to set it up with CIFS to save the file to a shared folder on a Mac, however although the folder has read/write ...
user avatar
  • 21
1 vote
1 answer
83 views

change default editor for command line tasks?

I want to create a cron job. Launching a terminal window, and entering crontab -e opens my current crontab, but opens it in the editor vi. I would prefer to use the nano editor. How do I configure ...
user avatar
  • 3,220
2 votes
1 answer
255 views

Can I view local/unix mail (`mail` in the Terminal) in Mail.app?

I use cron to run some jobs, but since that's the only thing I use my unix mail for, having this run through Mail.app would be a nicer experience than seeing "You have new mail." in the Terminal. How ...
user avatar
2 votes
0 answers
432 views

Auto logout inactive users

My iMac is set up using Parental Controls to limit how long my kids can use it. When their time is up, they are no longer able to use the iMac. However, their accounts are not logged out, and ...
user avatar
  • 598
0 votes
1 answer
103 views

Crontab didn't work as intended

I set crontab but nothing happened, crontab -l 03 04-22 * * * python /me/radio_alarm.py What's the reason, the command works as intended in Linux.
user avatar
  • 2,309