LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crontab on NI Real Time Linux

Solved!
Go to solution

We have a NI 9068 chassis with NI Real Time Linux as the OS.  Does anyone know how to successfully setup and run a cron job?

 

Other NI reference documentation indicates that cron should be used to run periodic commands from the base OS and that cron is providing with the busybox package.  The version of busybox running on the chassis is 1.20.2 and was only compiled with crond and not crontab? 

 

I tried installing the cronie package using opkg. It did install successfully and allowed me to run crontab.  However, when trying to run the crontab all I get is a segmentation fault.

 

Am I missing something?

 

Thanks in advance!

0 Kudos
Message 1 of 5
(4,655 Views)

Hi Johnnie,

To be honest, I’m not really familiar with those Linux commands. Have you already posted on the Linux Real-Time Community?

https://decibel.ni.com/content/groups/ni-linux-real-time?view=discussions

 

There is a better chance that you can receive more inputs there, since this is more related with Linux than with LabVIEW.

 

Regards,

AGJ

0 Kudos
Message 2 of 5
(4,627 Views)
Solution
Accepted by topic author JohnnieM

Thank you for the reply AGJ!

 

I did not post this question to the Linux Real-Time Community.  When I created the post I looked for a Linux forum but did not locate one.  Thanks for the link.

 

I have actually resolved the issue late last night.

 

Out of the box the init system runs crond.  There is a premade crontab file for the root user located at /etc/cron/crontabs.  That file can be edited with vi (or another editor if you have one installed on the chassis).  That editing process is normally accomplished with the crontab -e command, but directly editing the file works.

 

Hopefully that helps the next poor soul who needs to set up cron jobs on the 9068.

 

Cheers!

Message 3 of 5
(4,622 Views)

Hi Johnnie,

Thank you for posting that. It might be certainly helpful for someone else later.

 

Regards,

AGJ

0 Kudos
Message 4 of 5
(4,620 Views)

Does not work on the my Rio 1900 the files on my rio:

./etc/init.d/crond
./etc/cron.deny
./etc/crontab
./etc/cron.monthly
./etc/logrotate.d/cron.conf
./etc/pam.d/crond
./etc/rc0.d/K60crond
./etc/rc1.d/K60crond
./etc/rc2.d/S90crond
./etc/rc3.d/S90crond
./etc/rc4.d/S90crond
./etc/rc5.d/S90crond
./etc/rc6.d/K60crond
./etc/cron.weekly
./etc/sysconfig/crond
./etc/cron.daily
./etc/cron.d/logrotate
./etc/cron.d
./etc/cron.hourly
./run/crond.pid
./run/cron.reboot
./var/lib/opkg/info/cronie.postinst
./var/lib/opkg/info/cronie.preinst
./var/lib/opkg/info/cronie.postrm
./var/lib/opkg/info/cronie.prerm
./var/lib/opkg/info/cronie.control
./var/lib/opkg/info/cronie.list
./var/volatile/tmp/crontab.yikQ9L
./var/volatile/tmp/crontab.7hoKn1
./var/volatile/tmp/crontab.E29XBN
./var/volatile/tmp/crontab.UQn3rM
./var/volatile/log/cron.log.1.gz
./var/volatile/log/cron.log
./var/volatile/log/cron.log.2.gz
./var/volatile/log/cron.log.3.gz
./var/volatile/log/cron.log.4.gz
./var/spool/cron/root
./var/spool/cron
./usr/bin/crontab
./usr/sbin/crond

 

Note that NI support told me to edit the /etc/crontab file; however, that did not work.  I went in cgywin and made a crontab and copied that to /var/spool/cron/root.  However, I was getting PAM errors in the cron log.  The only possible concern could be that admin was not in the password file.  So I copied the root entry in the password file to the admin account as shown:

root:x:0:0:root:/home/admin:/bin/sh
admin:x:0:0:admin:/home/admin:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh

Then I did a passwd on root, and made it the same as the admin password.  Warning do not use passwd on admin for NI will trap it and update the admin password. After you change the root password edit it in /etc/shadow and copy it to admin as shown below.  I made the root password the same as original admin password. 

 

root:$6$2OaNycFJ$CKQbk72S8fLSEZ2W4Ch5rTCcSStvAMENOg3JjXbP0uuuaF8yW0UwebSxouM38C0bJ4HYZmNnC9hri6OtMdZBA1:16756:0:99999:7:::
admin:$6$2OaNycFJ$CKQbk72S8fLSEZ2W4Ch5rTCcSStvAMENOg3JjXbP0uuuaF8yW0UwebSxouM38C0bJ4HYZmNnC9hri6OtMdZBA1:16756:0:99999:7:::
daemon:*:16591:0:99999:7:::
bin:*:16591:0:99999:7:::
sys:*:16591:0:99999:7:::

 

Then look in /var/log/cron.log to see if your cron job ran

2015-11-17T22:00:01.000+06:00 NI-myRIO-1900-AMO CROND[17998]: (root) CMD (/usr/bin/logrotate /etc/logrotate.conf)
2015-11-17T22:00:01.000+06:00 NI-myRIO-1900-AMO CROND[18154]: (admin) CMD (/usr/sbin/rdate -s time-nw.nist.gov)
2015-11-17T22:00:01.000+06:00 NI-myRIO-1900-AMO CROND[18155]: (root) CMD (/usr/bin/logrotate /etc/logrotate.conf)

 

 

 

 

0 Kudos
Message 5 of 5
(4,396 Views)