script run fine from ./ but when put in cron does not run
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'd imagine the problem is that you're using "sudo find" - the sudo's going to hang, waiting for the user's password. Is it possible to put it in root's crontab?
You can always add to /etc/sudoers something like "username ALL=NOPASSWD: ALL" and then it wont ask for pass or of course drop sudo or run the script as root.
You can always add to /etc/sudoers something like "username ALL=NOPASSWD: ALL" and then it wont ask for pass
If you do this be aware of the massive security risk - any malicious program can include "sudo rm -rf /" and it will execute without any problem because you've set 'sudo' to not ask for a password. Running the script as root is a better solution.
Of course is a security risk, but it's a security risk if you let it be. There is no security risk if he knows what he's doing, or anyone, if you know how to protect your system.
I'm using this for years and somehow never ever anything happened, I wonder why
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.