Page 1 of 1

What causes the 'No such file or directory' error when adding a cron job?

Posted: Fri Jul 14, 2023 6:27 am
by TeetharKehar
I encountered an error while following the guide to set up Nagios plugins. Specifically, when attempting to add a cron job, I received the following error message:

root@lpslibrenms1:/etc/cron.d# */5 * * * * librenms /opt/librenms/services-wrapper.py 1
bash: */5: No such file or directory
Interestingly, when I list the contents of the librenms folder using the ls command, I can see the services-wrapper.py file. However, I'm confused about the presence of a .py 1 file.

Could you provide further clarification or guidance regarding the intended usage or purpose of the .py 1 file in this context?

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Sun Jul 16, 2023 2:31 am
by kg2857
That looks like a cron syntax issue having nothing to do with nagios. Try man cron.

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Sun Jul 23, 2023 8:39 pm
by paxtonleiny
That seems to be an issue with the syntax of cron and has nothing to do with nagios. If you want to use man cron, you can.

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Sun Jul 23, 2023 11:57 pm
by kg2857
kg2857 wrote: Sun Jul 16, 2023 2:31 am That looks like a cron syntax issue having nothing to do with nagios. Try man cron.
LoL. Sounds familiar...

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Fri Jul 28, 2023 2:02 am
by katyswift468
As mentioned previously, a crontab is a special file that holds the schedule of jobs cron will run.
Mapquest Directions

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Fri Jul 28, 2023 6:17 am
by Aliyaa
kg2857 wrote: Sun Jul 23, 2023 11:57 pm
kg2857 wrote: Sun Jul 16, 2023 2:31 am That looks like a cron syntax issue having nothing to do with nagios. Try man cron.
LoL. Sounds familiar...

Re: What causes the 'No such file or directory' error when adding a cron job?

Posted: Sun Jan 21, 2024 12:52 pm
by HenryWatson
Charmaine wrote: Mon Jul 17, 2023 11:25 pm
TeetharKehar wrote: Fri Jul 14, 2023 6:27 am I encountered an error while following the guide to set up Nagios plugins. Specifically, when attempting to add a cron job, I received the following error message:

root@lpslibrenms1:/etc/cron.d# */5 * * * * librenms /opt/librenms/services-wrapper.py 1
bash: */5: No such file or directory
Interestingly, when I list the contents of the librenms folder using the ls command, I can see the services-wrapper.py file. However, I'm confused about the presence of a .py 1 file.

Could you provide further clarification or guidance regarding the intended usage or purpose of the .py 1 file in this context? Depositphotos
thanks for your post. When setting up a cron job, it will run in the context of a specific user. If the file or folder belongs to another user or resides in a user-specific folder, the cron job may not have access to it, resulting in the error "No such file or directory" .
Thanks for help guys