I don't know how to set up cron with ssh?
I opened ssh and typed "crontab -e". What do I do then?
I want to repeat the function every minute. I have this code as "cron command to run": php -f /var/www/vhosts/nf-test-host.tk/httpdocs/admin/cron/cron.php.
I am on CentOS. What should I do, exactly? Thanks in advance!
You can try out different timing values in the crontab sandbox. It will show you a list of run times. www.dataphyx.com/cronsandbox/.
Here is your answer:
http://drupal.org/node/23714
(If you are not running Drupal, that is fine, this still applies equally well to you.)
Let us know.
Use command:
sudo yum install vixie-cron crontabs
or look this
http://shanerutter.co.uk/2011/11/23/centos-installing-cron-cronjobs-or-cron-daemon-crond/
Related
So mongo was running fine, and then I tried to create a database and a collection. Long story short, the server stopped responding. I thought (after about 6 hours of trying everything else, asking my friends and getting literally nowhere) that maybe I should just uninstall and reinstall mongoDB. Turns out that was a mistake, because now when I try to do the mongo command I get this
$ mongo
bash: /c/Program Files/MongoDB/Server4.4/bin/mongo.exe: No such file or directory
I noticed that there is no "/" between Server and 4.4 --- I think that's the issue, but I have no idea how to fix that. An yes, I have added MongoDB to my system variable path...
What is going on here?
It seems like commands are working now. I guess I just needed to wait like 8 hours!?
i would like to run a small query every time postgres is restarted, is this possible?
I have found that is possible to do that every time psql is launched, using .psqlrc but that does not address my need
thanks
For those coming here looking for a solution, as of today (2020, postrgresql 12) it is not possible to configure postgres to always run a given script/query.
You can of course use your own launch script but you can not prevent, it seems, other people restarting their way if they have the right permissions.
Using Capistrano v3, how can I run all remote tasks through su as another user? I cannot find anything in the official documentation (http://capistranorb.com/)
For my use case, there is one SSH user and one user for every virtual host. User A connects to the server and should run all commands as user B.
This isn't much of an answer, but I don't think what you are trying to do is possible without code modifications. Here's why:
There are two primary cases where you would use a different user:
Deployment needs to run as a particular user because of file ownership.
Deployment needs to run with root permissions.
In the first case, you generally would simply tell Capistrano to ssh as that user.
In the second case, you would tell Capistrano to run certain commands with paswordless sudo (http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/#authorisation).
I can see a situation where only one user is available via SSH, but file ownership and permissions is based on another user, so you want to make su part of the workflow. I'm sure it is possible to do, but if I had to do it, I would be reading the source code of Capistrano and overriding how shell commands are executed. This would be non-trivial.
If you have a specific command like rm which needs to run as a different user, you may be able to use the SSHKit.config.command_map[:rm] = 'sudo rm' mechanism to do it.
In a nutshell, I don't think what you are asking for is, on its face, easily done with Capistrano. If you have a specific use case, we may be able to offer suggestions as to how you may approach the problem differently which plays better to Capistrano's strengths.
Good luck!
Update
Looking further, the capistrano-rbenv gem has a mechanism by which it has overridden the execution of all commands:
task :map_bins do
SSHKit.config.default_env.merge!({ rbenv_root: fetch(:rbenv_path), rbenv_version: fetch(:rbenv_ruby) })
rbenv_prefix = fetch(:rbenv_prefix, proc { "#{fetch(:rbenv_path)}/bin/rbenv exec" })
SSHKit.config.command_map[:rbenv] = "#{fetch(:rbenv_path)}/bin/rbenv"
fetch(:rbenv_map_bins).each do |command|
SSHKit.config.command_map.prefix[command.to_sym].unshift(rbenv_prefix)
end
end
https://github.com/capistrano/rbenv/blob/master/lib/capistrano/tasks/rbenv.rake#L17
You might have success with something similar.
In order to run all remote tasks through su as another user I think you need to change Ownership for that User.
I'm Assuming that deployment folder name is /public_html/test .
sudo chown User:User /public_html/test # `chown` will change the owner ship so that `User` user can `**Read/Write**`
umask 0002
sudo chown User:User public_html/test/releases
sudo chown User:User public_html/test/shared
Hope this will solve your issue!!!
I'm trying to install PostgreSQL on Cygwin as a user and i'm getting stuck on the part where I have to create a database server, after i execute the pg_ctl command, it just prints "server starting" and runs in the foregorund indefinitely, here's a picture of what I'm talking about:
http://postimg.org/image/oh7ucgt9h/
Im generally a beginner to databases so any pointers would be great.
Chances you are hanging allocating shared memory. Please go with the native Windows build instead. It is far easier to manage.
However if you insist, make sure the ipc-daemon is running before you run PostgreSQL. This will probably solve your problem.
You could run:
ipc-daemon --install-as-service
net start ipc-daemon
And this should do it.
I have around 1000 servers on which I need to restart the SNMP service on, is there an easy method to this via a script or a batch file?
Do you have any sort of collection of the IP's and the root users and passwords (or SSH keys)?
If so, you could use a for loop to cycle through them (implementation depends on the way they're stored), and select the username and password with regular expression filtering or selecting by field and use expect to provide it the password.
If you don't have a collection like that, it seems that you'll have to build a database of them, and it may just be easier to do it manually, but it may be worth creating the database anyways in case you ever need to do this again.
You should give a look to Ansible provisioning tool.
The steps should be somthing like this:
Install Ansible: sudo apt-get install ansible (on ubuntu)
Define your server groups at /etc/ansible/hosts
[snmpservers]
myhostnames[01:10000].example.com
Restart the service on all servers
ansible snmpservers -m service -a "name=snmp state=restarted"