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

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
TeetharKehar
Posts: 7
Joined: Sun Jan 01, 2023 8:15 am

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

Post 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?
kg2857
Posts: 234
Joined: Wed Apr 12, 2023 5:48 pm

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

Post by kg2857 »

That looks like a cron syntax issue having nothing to do with nagios. Try man cron.
paxtonleiny
Posts: 1
Joined: Sun Jul 23, 2023 8:27 pm

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

Post 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.
kg2857
Posts: 234
Joined: Wed Apr 12, 2023 5:48 pm

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

Post 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...
katyswift468
Posts: 2
Joined: Thu Jun 22, 2023 9:01 pm

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

Post by katyswift468 »

As mentioned previously, a crontab is a special file that holds the schedule of jobs cron will run.
Mapquest Directions
Aliyaa
Posts: 4
Joined: Wed Jun 21, 2023 10:38 am
Location: India
Contact:

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

Post 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...
HenryWatson
Posts: 1
Joined: Sun Jan 21, 2024 12:50 pm

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

Post 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
Post Reply