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
1
vote
1answer
134 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 ...
1
vote
2answers
111 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), ...
3
votes
1answer
41 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 ...
0
votes
0answers
31 views

Crontab on mac not working - doesn't have the correct PATH / shell? [duplicate]

I have crontab schedule which runs, however it doesn't have my normally available terminal commands. I guess it doesn't have the correct $PATH, user or something like that? The crontab: 51 16 * * * ...
2
votes
2answers
341 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 ...
4
votes
1answer
741 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/...
5
votes
3answers
370 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....
0
votes
1answer
83 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 ...
0
votes
1answer
76 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 ...
1
vote
1answer
28 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 ...
2
votes
0answers
154 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. ...
0
votes
0answers
70 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 ...
2
votes
2answers
52 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 ...
1
vote
0answers
39 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 ...
1
vote
1answer
41 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 ...
2
votes
1answer
73 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 ...
2
votes
0answers
318 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 ...
0
votes
1answer
67 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.
0
votes
1answer
287 views

Cron mail notifies error of suspicious unknown script

Thanks to the mail function of the Terminal it came to my attention that there was some kind of cron job being executed with some errors. The mail of the cron gives this info: 2018-08-02 23:47:22....
2
votes
1answer
86 views

Run backup script at any time every weekend (using launchd?)

I recently lost configuration of one of my IDEs (deleted it myself, I am very smart). I had a backup but it was a few months old. I have a script to backup all my config and push it to GitHub. I was ...
1
vote
1answer
223 views

Can't open crontab

I tried running crontab on my Mac for the first time and got the following: $ crontab -e crontab: no crontab for User - using an empty one crontab: subl -w: No such file or directory crontab: "subl -...
2
votes
0answers
2k views

How do I kill a currently running cron job on macOS High Sierra

Edit: This question is NOT a duplicate of How do I restart the cron service on OSX? as I explained in point 3... I am busy trying to test a process that's started using the crontab on macOS High ...
0
votes
1answer
887 views

Run cron script at wakeup [duplicate]

I would like to run a script at wakeup. So my laptop is sleeping, I open the lid, and the script should run immediately or within the minute after wakeup. This script should run at startup as well, as ...
4
votes
2answers
157 views

error code 4960 when saving a .plist

I'm trying to create a .plist file in textwrangler, something I've never done before. I'm using these instructions which tells me to: Save code as com.rTask.plist file under path ~/Library/...
1
vote
2answers
2k views

Mac mail mail from cron

From sandeep@Sandeeps-MacBook-Air.local Fri Mar 23 20:04:23 2018 X-Original-To: sandeep Delivered-To: sandeep@Sandeeps-MacBook-Air.local From: sandeep@Sandeeps-MacBook-Air.local (Cron Daemon) To: ...
5
votes
3answers
958 views

How do I know if a time machine backup is running?

Due to APFS having a mind of its own and filling the hard disk with unwanted snapshots, I made a cron to run tmutil deletelocalsnapshots xxx. Later I found out that running this command while a backup ...
1
vote
1answer
196 views

Stop cron daemon “symmetrical.xm” error messages in Terminal mail

After upgrading to High Sierra (I think) I've started receiving the following message almost every time I start up Terminal: You have new mail in /var/mail/MyUsername I had some problems upgrading ...
10
votes
2answers
5k views

Is cron command supposed to work like this?

I've set up cron to run a script hourly but when I reboot cron does not work. Does this mean that I should run cron whenever I boot into my Mac? The cron command which I use cron 5 * * * * path/to/...
2
votes
2answers
6k views

cron and “command not found”

I'm setting up a cron job to run an executable bash script which contains a pypdfocr command. Whenever I manually execute the script everything works as expected, if instead I use cron with this ...
0
votes
0answers
30 views

Is there a way save with cron?

Is there a cron command that go into a specific App and save? Or, another way around, how to save an App with a bash script? (and run the script with cron). Running OS 10.11
1
vote
2answers
489 views

rsync cron job for backup not working

I'm trying to run a backup from one HDD to another at 10pm everynight on a Mac Pro. I have tested the rsync and it backups just fine outside of the cron table. Here is what I have and it's not running ...
1
vote
1answer
78 views

save mysql backup to afp network drive fails as cron job

For some strange reason I am not able to save a generated mysql backup via mysqldump to an afp network drive as a cron job. If I call the shell script as root user (login via sudo su in terminal), it ...
1
vote
1answer
218 views

Bash script for /etc/crontab

I want to run after every reboot, with no user logged kextunload /System/Library/Extensions/AppleHDA.kext I tried to do a bash script here : #!/bin/sh PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/...
2
votes
2answers
598 views

Show dialog at login (bash script)

The idea is that when somebody logs in to my Mac, a popup will show up and the date/time are written to a log. I run the bash script from a cron job: @reboot ~/Develop/login.sh (I know about ...
0
votes
1answer
593 views

Crontab and session locked

I would like to execute a script on my machine every five minutes, even when I am not in front of my mac OS X Yosemite. Therefore, I would like to lock my session and shut off the screen while the ...
3
votes
0answers
34 views

How to force Wi-Fi to rescan available sources and reconnect to a fixed named source from crontab?

I have a server computer running macOS and sometimes is using Wi-Fi only in evenings. The room's router supporting the Wi-Fi source is set to automatically reboot weekly. So when that happens, the Wi-...
0
votes
1answer
340 views

How to reconnect VPN by using Tunnelblick from command line?

The use case is that I need a particular VPN connected at all times on one of my servers which runs macOS. It's set up with Tunnelblick. And I know how to re-connect to it manually using Tunnelblick ...
2
votes
2answers
1k views

How to get macOS Wi-Fi device name programmatically in Bash script?

bash% networksetup -listnetworkserviceorder An asterisk (*) denotes that a network service is disabled. (1) SAMSUNG Modem (Hardware Port: Modem (SAMSUNG_MDM), Device: SAMSUNG_MDM) (2) Ethernet (...
1
vote
2answers
577 views

Running Cron Job w/ Sudo permissions

Strictly for learning purposes (possibly maintenance as well) I am trying to have a Cron job empty my trash once a day. I have opened terminal and entered the command crontab -e to access the VI ...
1
vote
2answers
1k views

How to access Keychain of my user from cron?

security list-keychains print: "/Users/vitaly-zdanevich/Library/Keychains/login.keychain-db" "/Library/Keychains/System.keychain" but the same command from cron return: "/Library/Keychains/System....
0
votes
1answer
1k views

How to run AppleScript in a Crontab?

I am using OS X 10.11.5, I have a crontab file under '/tmp/crontab', in which it contains: 01 10 * * * /Users/Jhon/Desktop/somescript.scpt When I run crontab -l I get output as no crontab for Jhon ...
1
vote
2answers
524 views

How to schedule VLC recording with cron?

I've created the following crontab: 0/5 * * * * /Applications/VLC.app/Contents/MacOS/VLC -I rc rtp://@xxx.xxx.xxx.xxx:5050 --sout='#transcode{vcodec=h264,vb=2048,acodec=mp3,ab=192,deinterlace}:...
5
votes
1answer
6k views

How to check if cron job works?

I use crontab -e without sudo to edit cron jobs and add the following line there - 20 22 23 10 * date "+%Y-%m-%d %H:%M:%S" >> ~/Documents/log.txt then I check the log file and it doesn't ...
2
votes
1answer
859 views

Problems executing an osascript command via cron

I have a little shell script which creates a new reminder for a project. This works pretty fine and I can execute in the command line newCfSamples "my new sample" and the reminder gets created. I now ...
1
vote
2answers
704 views

How to run script using cron or launchd for Guest user account in El Capitan

I could not find a way of executing a script for the Guest account during login which executes every minute. They say using cron daemon is deprecated so it looks like I will be using launchd with ....
1
vote
1answer
192 views

How to use macports Python in a cron job?

I have installed Python 2.7 through mac ports, and now want to have it used in a cron job. Unfortunatly, each time the cron job gets involved, the standard Python of my machine (an iBook G4 using ...
2
votes
0answers
52 views

Do I really need a huge plist file to replicate this cron job?

I am looking to create a launchd job that will execute Monday through Friday at 7:32am, 8:32am, and 2pm. Do I really need a plist that has an array of 15 <dict> elements for every combination of ...
1
vote
2answers
10k views

Crontab task “LSOpenURLsWithRole() failed … with error -600 for the file …”

I just moved to a new MacBook with El Capitan and trying to set up my crontab to do backup tasks. Here is how I have it set up (via crontab -e) 40 7 * * * /Users/myusername/daily.sh "daily tasks run ...
6
votes
2answers
692 views

How to automatically deliver /var/mail/USER to my Gmail?

My cron jobs sometimes sends mail to /var/mail/USERNAME. I normally read it by log on the Mac computer and run mail command to read and delete these mails. But how to deliver/forward such mails to ...
1
vote
1answer
2k views

Run a command on a schedule and verify that it has run

I want to run an rsync command each day or more often to back up a raspbery pi on my network to a drive attached to my mac. I see launchd, but I'm very confused about how to get it to work, and I ...