Closed snetwork-dev closed 3 years ago
I don't have a particularly easy way to test this without messing around with my local system, but my initial very vague suspicion would be that this tool uses things like File.expand_path("~/Library/LaunchAgents/#{name}.plist")
instead of ENV["USER"]
, leaving the daemon being launched from the wrong user, essentially.
Can you check if the logs/etc exist in either the admin or normal user's ~/Library/LaunchAgents
and ~/Library/Logs/com.github.domt4.homebrew-autoupdate
?
You're right. Both, the LaunchAgent /Users/admin/Library/LaunchAgents/com.github.domt4.homebrew-autoupdate.plist
and the log file /Users/admin/Library/Logs/com.github.domt4.homebrew-autoupdate
exist at the admin user (which is called with sudo).
Since the admin user is hardly or not logged in at all, the homebrew-autoupdate LaunchAgent is never started either. Is there a way to rebuild the script so that homebrew-autoupdate is executed under the logged-in user?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Is there a way to rebuild the script so that homebrew-autoupdate is executed under the logged-in user?
I'd be happy to review a PR that attempts this in a sensible way, but I don't have the time to do so myself now I'm back to working full-time sadly. Happy to come back to this in future if I can.
homebrew-autoupdate is not working with
sudo -uH admin
orsu - admin
Homebrew is installed within an administrator account (not root). For daily use I granted a normal user to manage homebrew via sudoers-entry.
So things like
sudo -Hu admin brew install/update/etc
orsu - admin
and afterwardsbrew install/update/etc
are working flawlessly.The only thing which is not working is homebrew-autoupdate.
If I were logged in as admin - everything is fine. But if I was logged in as a normal user,
sudo -Hu admin brew autoupdate --start 7200 --upgrade --cleanup --enable-notification --debug
or firstsu - admin
and afterwards the previous brew autoupdate command, results in:sudo -Hu admin brew autoupdate --status
reports:Also if I log in first as admin, run
brew autoupdate --start 7200 --upgrade --cleanup --enable-notification --debug
, log out and log in afterwards as a normal usersudo -Hu admin brew autoupdate --status
reports the same:What is more, even if the setup works with a local admin account logon - as soon as the admin user is logged out, the launch daemon
application.com.github.domt4.homebrew-autoupdate.autoupdater.42866421.42866425
is no longer running.