macOS Majoave 10.14.4
My Mac is set to go to sleep after 5 minutes of no activity. I used Jiggler to prevent this. I set up a crontab that will automatically start Jiggler 8am in the morning.
0 8 * * * open -a Jiggler
It worked fine before but stopped working a few days ago. From the log I can see something like below:
com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.user.0): Could not import service from caller: caller = open.79537, service = com.stick.app.jiggler.13728, error = 134: Service cannot load in requested session
What could be the issue and how to fix it?
The issue is because it is trying to run Jiggle with the root user, and not your MacOS user. But this app cannot run as root [and should never run as root anyway].
This message is telling this:
com.apple.xpc.launchd.domain.user.0
Is says the failed session was a user domain session, for the UID 0 [which is root]
Was your MacOS user logged in at 8h00 AM on the Graphical interface? when that error occurred?
To fix it you must adjust your cron job to run under your username, and because this is a graphical application, your user need to have an active session (logged in graphically) for this job correctly be executed.
Related
I am using cron_rstudioaddin() to schedule a refresh of an R script every minute, however it is not working. The job is attempting to run the script, I can see this as it modifies every minute, however I am getting an error on each attempt.
The cron job log file gives the following error:
Operation not permitted
Fatal error: cannot open file '/Users/xxxxxx/Desktop/FolderName/update_merge_script.R': Operation not permitted
I have given Full Disk Access to RStudio and Terminal in Security & Privacy in System Preferences.
The script works perfectly when I run it manually in RStudio, so I'm guessing its an issue with the schedule.
Any help would be really appreciated.
Opening macOS Console and looking at the System Log i ran into this error message that keeps repeating itself indefinitely:
com.apple.xpc.launchd[1] (com.macpaw.CleanMyMac4.HealthMonitor[21558]): Service exited with abnormal code: 78
com.apple.xpc.launchd[1] (com.macpaw.CleanMyMac4.HealthMonitor): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
com.apple.xpc.launchd[1] (com.macpaw.CleanMyMac4.HealthMonitor[21559]): Could not find and/or execute program specified by service: 149: Could not find a bundle of the given identifier through LaunchServices: com.macpaw.CleanMyMac4.HealthMonitor
I also tried to search inside
home/Library/LaunchAgents
but cannot find anything about CleanMyMacX.
A few days ago I deleted the "HealthMonitor" application because it was always running in background. I think that some service is trying to keep the application alive, but how can I stop it?
If you're not seeing it there, it's likely a launch daemon, not an agent. That means the binary is located in the /Library/PrivilegedHelperTools/ directory and its registration file is located in the /Library/LaunchDaemons/ directory.
In order to perform some automation job through GitLab-CI, I have a Mac mini runner (macOS 10.14.6 Mojave).
The job requires an authenticated user through the mean of an active Kerberos ticket.
In order to have the ticket created and renewed automatically I made a small script as follows:
#/bin/bash
source ~/.zshrc
USER=<user>
DOMAIN=<domain>
PASSWORD=<password>
KEYTAB=<path/to/file.keytab>
# Remove keytab if present
if test -f "$KEYTAB"; then
rm $KEYTAB
fi
# Create keytab file
/usr/sbin/ktutil --keytab=$KEYTAB add -p $USER#$DOMAIN -w $PASSWORD -e aes256-cts-hmac-sha1-96 -V 1
# Init ticket
/usr/bin/kinit --keytab=$KEYTAB -f $USER#$DOMAIN
When I run this script directly in Terminal, it successfully creates the keytab file and inits the ticket which shows up inside the Ticket Viewer app available through the Keychain Access app.
However when this script is run by the cron job, even though no error gets printed to the console, the ticket does not appear in the Ticket Viewer app.
Cron job for reference:
$ crontab -l
# Renew ticket every 4h
0 */4 * * * ~/renew_ticket.sh >> ~/renew_ticket.cron.log 2>&1
Any clue, why the ticket creation fails when running with cron?
Edit: 2021-08-13
I'm now using the "Kerberos Ticket Autorenewal" Mac app from Eugene Homyakov.
The app is available in the Mac App Store and you can find more info at https://hamstergene.github.io/macapps/ticket-renewer.
It's doing the job but I'm not really a fan of relying on a third party app, as it is not open source and could stop working with a new release of macOS if it's not maintained.
I also contacted Brad Howes after reading his article at http://keystrokecountdown.com/articles/kerberos.
He suggested that cron jobs are not running in the same environment as the regular user and that it may cause issues with the renewal of the ticket.
He also pointed out 2 utilities worth considering:
k5start https://linux.die.net/man/1/k5start
krenew https://linux.die.net/man/1/krenew
I'll have a look at those and report back any progress here.
I've got a chef deployment script that works well. To start the script off all users a logged off, application installed and then system rebooted with
reboot "app_requires_reboot" do
action :request_reboot
reason "Need to reboot when the run completes successfully."
delay_mins 0
end
Instead of rebooting I want to have the script logon the user instead.
I can't see to find the command to make this work.
Any ideas?
I'm looking for a way to setup a list of script that run when I log out.
Basically, I want to write a server shutdown scripts for myself that will run automatically when a user log out or shut down per user logon. Able to start the server on logon via launchd. And how to shutdown server on logout.....
Env: Macbook pro 2010
OS version : OS X Version 10.9.2
Following link says that we cannot use logout script anymore :(
https://developer.apple.com/library/mac/documentation/macosx/conceptual/bpsystemstartup/chapters/CustomLogin.html