Unable to use cron command in Ubuntu

In Ubuntu 14.04 LTS I am unable to use the crond command even as sudo user with appropriate permissions (chmod, chown command) and after restarting cron and testing the file to ensure it works. Ubuntu will allow me to use the GUI and setup the script to run at the designated time but I want to use the command line.

I get the error...

cron: can’t lock /var/run/crond.pid, otherpid may be 10561: Resource temporarily unavailable

Please help.
Tech_20Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Seth SimmonsSr. Systems AdministratorCommented:
you use crontab to modify cron schedules
crond is the cron daemon that runs the service in the background
0
savoneCommented:
Exactly what command are you running?

the following command will allow you to edit or create cronjobs:

crontab -e

You can run it as root or as a user.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
You probably have another crond running - only one crond instance should be running.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tech_20Author Commented:
Thanks. After looking back at Terminal I was using cron and not crontab -e. I'll use that command structure and reply.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
To display your cron entries use: crontab -l
To remove your cron entries (be careful) use: crontab -r
0
Tech_20Author Commented:
Thanks. After reading and reviewing several web pages on cron. I'm still missing something. I type in crontab -e. I then see the number 57. On the next line, I type in my cron entry 10 15 * * * /folder/folder/file.ext. I then get a "?" after that.

Please help.
0
Tech_20Author Commented:
The issue is deeper than expected. After checking Ubuntu’s support site I found that I had to change the default editor to /bin/nano from /bin/ed. That worked and I then was able to access the crontab file but it would not save to the same file. The current crontab file is in my /tmp folder instead of /etc which I find strange.

In crontab –e, the only option is to save to a different name. Then the next time I open crontab-e it will open the same unedited file. I’m basically in a loop that won’t save current changes unless I repetitively find a way to point crontab to the new file.

Any suggestions?
0
Seth SimmonsSr. Systems AdministratorCommented:
sounds like there were unsaved changes; tmp folder is used when editing so if the pid of the editor crashes or something along those lines, the tmp file is still there
you need to delete the file(s) from that folder.  they are hidden so make sure to use ls -la to see them; they will start with . (period)

delete those and you should be able to edit crontab
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tech_20Author Commented:
@Gerwin Jansen, @savone:

Thanks. I went to another Linux machine and made the updates as my username and not sudo. It worked. Using sudo goes to another file besides /etc/crontab.

I'll now try Seth's suggestion on the 2nd issue with the tmp file issue.

Thanks.
0
Tech_20Author Commented:
I updated the Ubuntu Server software also just in case.

FYI, when I run as my username (admin) I go to crontab -e to the interface with the options at the bottom. I then press CTRL X to exit, press Y to save, the default location is another /tmp location, I manually type in /etc/crontab, press Y to overwrite and then I get permission denied.

When I run as sudo (admin) I go to crontab -e to the interface with the options at the bottom. I then press CTRL X to exit, press Y to save, again the default location is another /tmp location, I manually type in /etc/crontab, press Y to overwrite and then it works.

Ubuntu just takes more steps than other Linux flavors and it requires sudo while other Linux flavors (like CentOS7 tested) work better as the admin user already logged on.
0
Tech_20Author Commented:
Some Linux flavors work better with the crontab command as sudo user, some work better as the admin user.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.