问题
I have coded up a small ruby gem that I use on my laptop to check disk space and other things.
I am using a sidekiq worker that runs periodically and emails me status updates.
I was wondering how to make a sidekiq worker run automatically after I restart OSX? Is this possible?
Cheers
回答1:
To run sidekiq you need to run: bundle exec sidekiq
. If you want to run this on startup then you can follow these steps:
- Start Automator.app;
- Select "Application";
- Click "Show library" in the toolbar (if hidden);
- Add "Run shell script" (from the Actions/Utilities);
- Add script '
bundle exec sidekiq
Orcd YOUR_APP_PATH&&bundle exec sidekiq
; - Test it;
- Save it somewhere: a file called your_name.app will be created);
- Go to System Preferences → Accounts → Login items;
More startup script options are here
回答2:
Launch Redis on computer (Mac) starts.
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Edit redis-server /usr/local/etc/redis.conf
and set daemonize yes
After you saved file with this change just start server:
src/redis-server
来源:https://stackoverflow.com/questions/19361783/start-sidekiq-automatically-on-osx