Comments (13)
In Linux I added the script to my Startup Applications (Gnome). Have you tried that?
from git-dude.
I'm not OSX expert but maybe you could try running it on startup with launchd? @ml suggested this as the best way to run it in OSX.
from git-dude.
I meant launchctl, not launchd.
from git-dude.
Working on this now. If I can get it working I'll send a pull request your way if you like, might be useful to other OS X users out there.
from git-dude.
Unfortunately it seems like running this from launchd isn't working: it's able to run the script as would crond but the output isn't properly formatted and is not sent to growl-notify. Perhaps there's another way?
from git-dude.
Unfortunately I can't help you as I'm not using OSX.
from git-dude.
This is my solution on OS X ( still kind of new to mac myself ). Let me know what you think, don't think it's something to add to the project though.
#!/bin/bash
#
# run-gd - Simple script to run git-dude on mac-osx login
#
watchdir=$(git config dude.watchdir)
if [ -n $watchdir ]; then
git dude $watchdir
fi
I created a simple script inside my ~/.git-dude/ directory called run-gd, make it exec
$ sudo chmod +x ~/.git-dude/run-gd
Add a directory to watch in your git config
$ git config --global dude.watchdir ~/repo-directory
In OS X click
Apple->System Preferences->Users & Groups->[Select User]->Login Items
and add the shell script and mark it as hidden on launch.
Use cmd+shift+g
to search for a hidden folder while in Finder.
from git-dude.
While @StehlikC's solution works, I decided to roll my own launchctl
solution, and the only issue I ran into involved scoping of the PATH environment variable (my console log was littered with "command not found" errors for git
, sleep
, date
, and basename
).
While the PATH environment variable is being set in my ~/.bashrc
file (which is sourced from my ~/.bash_profile
file) the ~/.bashrc
file is only invoked for shells which are not login shells, so this won't work. I assumed launchctl
could use the directories specified in my /etc/paths
file, but that wasn't the case. launchctl
also didn't observe the files in /etc/paths.d
which contain path entries...
To my knowledge there are two "acceptable" routes to take for scoping the PATH environment variable for GUI/loginwindow processes:
- Use a
~/.launchd.conf
file which calls thesetenv
environment variable function to insert the PATH environment variable name into the current environment list. - Use a special property list file located at
~/.MacOSX/environment.plist
which the loginwindow application looks for to set user session environment variables.
I chose the latter of the two, and here's the contents of the property list file I created:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/bin:/usr/bin:/usr/local/git/bin</string>
</dict>
</plist>
/bin
is needed for thedate
andsleep
commands, as well as where (per the Readme instructions)git-dude
has been installed- I actually cloned the
git-dude
repository to a local sandbox area and symlinked thegit-dude
bash script into/usr/local/bin
so my PATH string also needed to include/usr/local/bin
- I actually cloned the
/usr/bin
is needed for thebasename
command/usr/local/git/bin
is where thegit
binary lives
A second property list file is needed to rig up launchctl
to kick off the git-dude
"daemon" at login. The file should live in ~/Library/LaunchAgents
and use reverse domain name notation (I went with com.sickill.git-dude.plist
) and contain the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.sickill.git-dude</string>
<key>LowPriorityIO</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>git-dude</string>
<string>/Users/<username>/.git-dude</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
- Replace
<username>
with your OS X user account name - Depending on where you have
git-dude
installed, you may need to prefix thegit-dude
command with a full path - If the repositories you want
git-dude
to watch don't live (or aren't symlinked) in the~/.git-dude
directory, specify the correct path
To test everything without constantly rebooting, you can run the following commands and watch your console log using Console.app:
$ launchctl setenv PATH /bin:/usr/bin:/usr/local/git/bin
$ launchctl load ~/Library/LaunchAgents/com.sickill.git-dude.plist
If the PATH environment variable is incorrect (you'll know because the console log will contain "command not found" errors) make any necessary changes and run the setenv
command again. If something is wrong with the property list file for configuring git-dude
you can unload the file (change load
to unload
in the second command above), make necessary changes, and run the load
command again.
One nice thing is that once you've got everything set up for git-dude
you can use the same configuration steps to run other scripts using launchctl
at startup.
Hope this helps someone. Cheers!
from git-dude.
Thx for your input @StehlikC and @digitaljhelms !
from git-dude.
No worries. Might be worth shoving this into a wiki page...
from git-dude.
I've put these instructions on Wiki: https://github.com/sickill/git-dude/wiki/Daemonizing
from git-dude.
Sorry to resurrect an old thread, but http://support.apple.com/kb/TS4267 indicates my instructions for using an environment.plist
file with launchd
is no longer valid for OS X Lion v10.7.4 or higher; I wasn't aware of this change as I jumped over Lion v10.7.4 in a recent upgrade from Lion v10.7.3 to Mavericks v10.9.
Anyway, my approach using launchd
still works, but is a lot less cumbersome as it all comes down to the PATH environment variable; as long as that's setup properly to include the paths where git
, git-dude
, date
, and sleep
live, you should be golden. RTFM for help: man path_helper
I've updated the wiki page on Daemonizing accordingly.
from git-dude.
Awesome, thanks!
from git-dude.
Related Issues (20)
- Selective monitoring of git commits HOT 3
- asks for password at every interval HOT 4
- need to specify .git-dude dir HOT 3
- notifier for debian ? HOT 3
- KDE integration HOT 3
- Handle forced push properly HOT 4
- npm package HOT 4
- Auto Merge config HOT 5
- duplicate notification at every interval HOT 9
- Using existing cloned repository HOT 4
- Fails handling fetch results other than new branch/tag/commit HOT 6
- Github links HOT 2
- Remove need for Github's username and password HOT 6
- Decide on a license HOT 3
- Issue and other activity notifications HOT 1
- Add OS X Notification Center notification backend support HOT 7
- Breaks with parenthesis in the repo name HOT 2
- Running as daemon through cron (Ubuntu 15.10) HOT 5
- Not displaying notifications. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-dude.