Crontab - Not allowed to use this program
Trying to setup a Cron job on a remote server, when i try to run the command crontab -e. It says i am not allowed to use this program.
I login to the remote server by using ssh, e.g. ssh -l loginname remoteseverip. where i then enter a password. Basically i gain only access to my user area within the server. Do i need add something into the Cron job to tell it to run under my own user account? Any ideas guru's? |
Quote:
do you own the server? if not, contact the administrator |
Is having the root access to the server the only way around this issue? my plan was to setup a Cron job for a script that will ping and find ip addresses logged into the server and save it as a text file and have this done every hour.
|
You don't mention what distro you are running. As root, you probably have to add the user to a group that is allowed to use cron, which is probably 'cron'.
|
Quote:
So contact the administrator. |
One possible option is that the administrator may have installed another task management program such as atd, which can be used to do regular jobs just like cron: http://linux.die.net/man/1/at
Or the system administrator may have simply locked down cron to stop you from using it. But you can still install cron separately onto your own user account. Warning: I've not tried this and it may not work. Basically, download the tarball, and install it using Code:
./configure --prefix=/home/username/cron && make && make install Code:
/home/username/cron/usr/sbin/crontab -e The simplest option, if you can't speak to whoever runs the server, is to write your own script to poll the time periodically and run your job whenever it needs to be run. |
Thanks for the replies! Now am getting problems with my script! This is what i have so far:
#!/bin/bash ip='ip addresses to ping' for address in $ip; do ping -c 1 -t 1 $host > /dev/null 2> /dev/null if [ $? -eq 0 ]; then echo $address fi done > output.txt for line in `cat output.txt` do ssh $line | ps -ef logout done > test.txt Basically the script should ping multiple ip addresses, store the results to a file. Then for each line in that file carry out a ps -ef command and then direct the results to another file. I get the output.txt file and test.txt file when i run it, but for some reason it just hangs after that. I suspect its because the ssh hasn't stopped, but cannot seem to solve it. |
I suspect your problem is the logout command, which is logging out of the current shell, since the ssh command will log out automatically when the ps command completes.
|
Quote:
|
lenny168, try putting echo lines into your script to find out where it is hanging.
You may want to redirect the output of echo to stderr so it doesn't get captured into files: Code:
echo message 1>&2 |
All times are GMT -5. The time now is 12:38 PM. |