@torchard and I have beat on this pretty hard on our end and can not get it to fail. @reboot works every time, with or without the sleep our test python app run just fine.
BTW, putting a space in Linux file names breaks best practices:
Best practice for Linux file naming
To prevent running into problems with your file paths on your site, we recommend following the best practices for file naming. See the below:
Name all your files lower case.
Instead of using a space, use an ( _ ) or a ( – )
Use consistent file types. Use jpg or jpg. Don’t use both.
Only alphanumeric characters, periods, underscores and hyphens and don’t use symbols like “%”, “$”, and so forth.
Keep the file names short and descriptive.
But that said, we tested a space in the file name and fully pathed out with quotes still worked in cron.
I guess we have the following questions:
What happens when you run the script from the console (and not back-grounding it)?
How do you know the script is not working?
How do you know the script is working?
Yes, I agree that’s probably not best practice. I’m not a heavy linux user. That aside, here are my answers to your questions.
When I run the script, it outputs my print statements to the terminal every few seconds, as programmed.
I know it’s not working because when I have the job running each minute, as in the commented code, I am able to send inputs (modbus register information) to my controller and my outputs are updated. That is how the script would behave if it were running. But when I comment the code out and restart the controller, my inputs are not received or turned into updated outputs.
Another note is I have tested the use of specific dates and times for starting the script. I selected a time on crontab just a few minutes into the future. I restarted the controller and did nothing to it, but at that time I selected the code started running again. That is why I feel it’s a reboot-specific problem.
Came across some issues when experimenting with this. It seems as soon as I add a “@reboot” entry and reboot the system the whole crontab file gets overwritten by repeated “^@” (some Unix null character?) Running periodic cron jobs works just fine and will persist during reboot. I add them using crontab -e and use the vim editor just as I would otherwise. I’ve never encoutered this issue on any previous Linux system I’ve used
Something is going on with the way the cron is being edited. @torchard and I (and many many other customers) have been using this method without issue.
Perhaps add nano and try editing it with that?
See this post on how to use nano vs vim as the editor:
Thanks for the quick response! I have tried using nano with no success unforunately.
After many tries with vim I did however manage to get it working for a while, using:
:set encoding=utf-8
:set nobomb
:wq
So perhaps its some sort of encoding error?
I had a simple script that would just echo a string to a file on reboot that worked kind of fine now. Although it took around a minute after I’ve gained control of the system after rebbot for it to execute the script, which is a behaviour I’ve never seen on my other Linux machines.
I then changed it to run another script on reboot, saved it using the encoding mentioned above. But now it’s back to breaking the crontab again. It seems very wierd that I can get it working sometimes so I will do some more testing and see if there is a way which I can replicate it to always run the @reboot cron job.
I’ve also noticed that when this issue occurs every character in the crontab is replaced by exactly one instance of “^@”
Any other ideas of what could be going wrong here?
Now that you expand it some more, I think I have seen something like that on a Raspberry Pi… What shell program are you using? The latest version of PuTTY?
ie, it was the editor, not the device…
Update on this issue: I think I’ve managed to solve it by having a script writing the crontab file instead of doing it manually, hopefully this way works moving forward without corrupting the crontab file.
Is there some documentation for the specific Linux distro the Groov Epic is running? I’ve tried to find info on it but haven’t found much.
The flavor of Linux is Debian, so you can start there. We take the Debian kernel and use Yocto to build the drivers etc needed for the groov hardware.
Can you flesh out the core of that question?
Sorry I’m a bit new to working with configuring Linux systems so I’m still trying to figure out what to ask etc. But for example, since I’ve used Ubuntu previously I’ve used the “service” command to manage Linux services. But in your distro it’s not used, and systemctl is not used either. So I was looking for some information regarding if you used some other way of mainting Linux services, something that may have been written in a documentation of some sort. If that question makes sense.
EDIT: Basically I wonder what core Linux functionality exists in your distro
Ok, Yes, that makes sense now.
No, nothing documented as shell is an option and not something we can support since it gives you root access and there are volumes upon volumes of Linux wisdom written in paper and on the Internet, it would be pointless for us to duplicate all that.
The only support is here in the forums (and only to the level of ‘the best the community can’).
Since you came in 1/2 way through the @reboot thread, it might help to perhaps start a new thread and help the community know what you are up to, what your plan is, what your goals are for running shell on the groov. I don’t think you have even mentioned if you are using EPIC or RIO or both for example.
Once we have a better bigger picture, we can perhaps brain storm the best way (not always shell given the vast tool set on the groov platform) forward.