I am trying to install an init.d script, to run celery for scheduling tasks. I'd like to launch celery automatically at startup.
Here is the steps I followed:
copied the file celeryd and pasted it in folder /etc/init.d/
created a configuration file celeryd in folder /etc/default/
update-rc.d celeryd defaults
reboot via "vagrant halt" and then "vagrant up"
Both files are owned by root:root and have 755 permissions.
I can launch the service manually:
$ sudo /etc/init.d/celeryd start
but it is not being launched automatically.
Running Ubuntu 12.04 in a virtualbox
Related
I can’t start a bunch supervisor and celery. Because celery does not see my module app.
/etc/supervisor/conf.d/celery.conf
[program:celery]
command=/home/ubuntu/django/.env/bin/celery -A main worker --app=main --loglevel=info
user=root
stdout_logfile=/home/ubuntu/django/deployment/logs/celery.log
stderr_logfile=/home/ubuntu/django/deployment/logs/celery_main.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
-django
--.env
--main
---settings.py
---celery.py
...
--orders
--shop
if I run this command in a virtual environment in my project directory everything works fine. But if I want to do it at a distance I can not, Why? In my logs celery says Error: Unable to load celery application. The module main was not found.
What I don't see in your configuration file is the working directory, that could explain why the celery command can not find the module, but it is working when you run it manually.
Try adding:
directory=/home/ubuntu/django
to your configuration file and see if this will fix the error.
I use to run the mongodb service with the command ( in CentOS)
sudo mongod --config /etc/mongod.conf
in mongod.conf file replica set information are there.
Now when my system is rebooted, I want automatically this service to run.
How can I do this ?
The /etc/rc.d/rc.local script is executed by the init command at boot time or when changing runlevels. Any command that you want to run after reboot can be added in this file. Just add the command at the end of the file /etc/rc.d/rc.local
You should also check the section Using a Basic Init Script in the following link: https://www.linode.com/docs/databases/mongodb/use-mongodb-to-store-application-data-on-centos-5/
Beanstalkd is running on my Ubuntu VPS. I don't know how to stop or shut down the beandstalkd server. I want to stop the server manually on the command line.
I've found monitoring tools and a configurations script, but no commands for the commandline.
Beanstalkd is normally run with the standard OS-level tools (so, on Ubuntu, upstart). There are a number of example configuration scripts for LaunchD, systemD and Upstart in the Beanstalkd repo.
For an Ubuntu system, you would copy the Upstart .conf file, making any required tweaks to the command line you need (to enable the binary log, for example) and drop it into the /etc/init/ directory. Then the usual start, restart, stop & status commands would be able to control the Beanstalkd daemon, and it could be auto-started on bootup.
If it's not already under upstart control, then you can simply kill the process, like anything else, by finding the process ID (pgrep -lf beanstalkd).
With a freshly installed version of Postgres 9.2 via yum repository on Centos 6, how do you run postgres as a different user when it is configured to run as 'postgres:postgres' (u:g) out of the box?
In addition to AndrewPK's explanation, I'd like to note that you can also start new PostgreSQL instances as any user by stopping and disabling the system Pg service, then using:
initdb -D /path/to/data/directory
pg_ctl start -D /path/to/data/directory
This won't auto-start the server on boot, though. For that you must integrate into your init system. On CentOS 6 a simple System V-style init script in /etc/init.d/ and a suitable symlink into /etc/rc3.d/ or /etc/rc3.d/ (depending on default runlevel) is sufficient.
If running more than one instance at a time they must be on different ports. Change the port directive in postgresql.conf in the datadir or set it on startup with pg_ctl -o "-p 5433" .... You may also need to override the unix_socket_directories if your user doesn't have write permission to the default socket directory.
pg_ctl
initdb
This is only for a fresh installation (as it pertained to my situation) as it involves blowing away the data dir.
The steps I took to resolve this issue while utilizing the packaged startup scripts for a fresh installation:
Remove the postgres data dir /var/lib/pgsql/9.2/data if you've already gone through the initdb process with the postgres user:group configured as default.
Modify the startup script (/etc/init.d/postgresql-9.2) to replace all instances of postgres:postgres with NEWUSER:NEWGROUP.
Modify the startup script to replace all instances of postgres in any $SU -l postgres lines with the NEWUSER.
run /etc/init.d/postgres initdb to regenerate the cluster using the new username
Make sure any logs created are owned by the new user or remove old logs if error on initdb (the configuration file in my case was found in /var/lib/pgsql/9.2/data/postgresql.conf).
Startup postgres and it should now be running under the new user/group.
I understand this might not be what other people are looking for if they have existing postgres db's and want to restart the server to run as a different user/group combo - this was not my case, and I didn't see an answer posted anywhere for a 'fresh' install utilizing the pre-packaged startup scripts.
Hey guys I'm running Centos 6.2 minimal, and I am trying to install LAMP for my server and following this tutorial.
It installed flawlessly however when I try to configure the services to start automatically, its cool with
/sbin/chkconfig httpd on
but when I try
/sbin/chkconfig --add mysqld
it says:
error reading information on service mysqld: No such file or directory
is mysqld installed? try yum install mysql-server or some such. it might also not be named mysqld but mysql see /etc/init.d/ directory for the scripts.
System cannot find mysqld in /etc/init.d
Try: locate mysqld
Normally it will be /u/sbin or /u/bin folder (depends on Operating system and default settings).
copy mysqld (if you find it) to /etc/init.d folder, check the file permission.
Then try chkconfig --add mysqld again.
Post your result of the command above if you still cannot get it going.