Skip navigation.
Home
The QNX Community Portal

View topic - Cron - Crontab

Cron - Crontab

For the old QNX2 and QNX4 RTOS

Cron - Crontab

Postby elmasciruja » Tue Oct 04, 2005 3:37 pm

Hi, i`m not really good with my english and i don`t know much in Qnx.
I have to run an application every hour.
I read that cron and crontab do that.
But the problem is that i try to configure it bau it really don`t work.
Please if someone write the steps to do that.

Thanks a lot.

Martin (From Argentina)
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

RE: Cron - Crontab

Postby noc » Tue Oct 04, 2005 5:09 pm

This page should get you started.

Post back the actually steps/errors if you still have problems.
Last edited by noc on Wed Oct 05, 2005 2:29 pm, edited 1 time in total.
noc
Senior Member
 
Posts: 1634
Joined: Sat Jul 06, 2002 4:34 am

Postby elmasciruja » Wed Oct 05, 2005 1:20 pm

Y start the cron like this

Cron -L -V
and in /usr/spool/cron.1/crontab/root

Y edited this

0 * * * * (sh -c path of the program) > /dev/con1

Mi question is:+
Is there any chance that the program executes every 15 minutes¿?
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

Postby SmeeAgain » Wed Oct 05, 2005 2:24 pm

from the docs:
Display the current time on the system console every 20 minutes:

1,21,41 * * * * (echo -n " "; date; echo) > /dev/con1

So for you it's just something like:
0,15,30,45 * * * * do_something

RTFM
SmeeAgain
Senior Member
 
Posts: 137
Joined: Thu Aug 12, 2004 3:59 pm
Location: Germany

Postby elmasciruja » Wed Oct 05, 2005 2:35 pm

Hi, i change te values fron 0,15,30,45 but still it doing every hour.
Is there any chance to stop the cron and start again ?
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

Postby noc » Thu Oct 06, 2005 12:05 am

Depending on how you modified the "crontab" file, you may need to restart "cron".
noc
Senior Member
 
Posts: 1634
Joined: Sat Jul 06, 2002 4:34 am

Postby elmasciruja » Thu Oct 06, 2005 2:43 pm

Two queestiosn:
1) How can i restart cron
2)Every time i reboot the machine i have to start Cron -L -v again.
Is there any chance that cron start automatically when i rebbot the machine???

Sorry again for my english
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

Postby noc » Thu Oct 06, 2005 4:38 pm

I guess you made a typo of "Cron -L -v"? It should be a lower case C like "cron".

To restart, you first kill it and then start it again:
slay cron
cron -L -v &

To make it auto start, you need to add it into /etc/config/sysinit.1 (assuming you are on node 1).

Please post the output from the following commands:

id
echo $NODE
ls -l /usr/spool/cron.1/crontab/
(you mentioned /usr/spool/cron.1/crontab/root in your above post, but I guess you must have made a typo).
ls -l /usr/spool/cron.1/crontabs/
noc
Senior Member
 
Posts: 1634
Joined: Sat Jul 06, 2002 4:34 am

Postby elmasciruja » Thu Oct 06, 2005 5:58 pm

Hi, the outputs of the commands are:

id:
uid=0 (root) gid=0 (root)

echo $NODE
1

ls -l /usr/spool/cron.1/crontabs/
Total 17

dr-xr-xr-x 2 root root 4096 oct 04 16:06.
dr-xr-xr-x 3 root root 4096 oct 04 10:29..
-rw-rw-rw-1 root root 66 oct 06 9:27 root

What can i do to put in sysinit.1 ?

Thanks a lot
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

Postby WhiteRabbits » Thu Oct 06, 2005 8:12 pm

you can put the line
cron -L -v &
into your sysinit.1 file.

for editing sysinit.1 :
type :
vi /etc/config/sysinit.1 with (ENTER)
or type :
vedit /etc/config/sysinit.1 with (ENTER)

for detailed information about vi visit :
http://www.qnx.com/developers/docs/qnx_ ... /v/vi.html

do not use a DOS or WINDOWS based texteditor to create or modify QNX related files.

good luck !
HELGE
WhiteRabbits
Senior Member
 
Posts: 196
Joined: Sun Aug 03, 2003 9:20 pm
Location: Germany

Postby elmasciruja » Thu Oct 06, 2005 8:30 pm

What is the difference between "cron -L -c &" and "cron -L -c"

Thanks a lot for all of the responses.

Martin (Argentina)
elmasciruja
Active Member
 
Posts: 17
Joined: Mon Sep 19, 2005 7:08 pm

Postby Pogoda » Fri Oct 16, 2009 1:54 pm

Good evening! Please help. I'm trying to start some executable file in cron, and it isn't start. And example with "echo..." not enough. :( I write in my crontab:
45 16 16 10 0-6 /tmp/myprog
What mean start exutable file by adress /tmp/.. at this time. What's wrong here? It needs to write PATH in environment variables?
Or I must write something like this? :
45 16 16 10 0-6 /tmp/myprog>/dev/con1

Thank you!

p.s. Sorry of my english.
Pogoda
Active Member
 
Posts: 29
Joined: Tue Mar 17, 2009 10:37 am

Postby juanplacco » Fri Oct 16, 2009 7:47 pm

1) is cron running? :D

2) What does your program actually do?

3) Try somthing like

* * * * * echo "Hi!" > /tmp/hi.txt

in crontab

4) Edit crontab entries with crontab -e.

5) Then check these entries with crontab -l

6) Check /tmp/hi.txt after a minute

7) Does it work?
juanplacco
Senior Member
 
Posts: 318
Joined: Wed May 17, 2006 2:30 pm

Postby Pogoda » Sat Oct 17, 2009 6:19 am

1) Yes, run it with command cron &
2)Program - executable file which move files from qnx fiel system to ntfs (smb mounted). At first I can't move it cause attributes don't write, and I replace moving to 2 actions: copy and removing files from initial directory. It works perfect when I start it manually from shell.
3)I made this example from one qnx book : * * * * * echo "Hi!">/dev/con1 and it write word "Hi" in shell in con1.
4) Editing crontab with vi? I can't understand how works with it. What command I must write to change editor to vedit?
5)I can see it. Is it terrible what I edit crontab withh key F4 in "Midnight Commander"?
6) I write answer in 3)
7)Yes it works, but how start my executable fiel?
I must logging it work like: /tmp/myprog > /tmp/hi.txt ?
Pogoda
Active Member
 
Posts: 29
Joined: Tue Mar 17, 2009 10:37 am

Postby juanplacco » Sat Oct 17, 2009 10:08 pm

You can export EDITOR environment variable to use your preferred editor.

So, I still don't gen your point. You have to keep in mind than cron does not inherit the environment variables. So if your program runs normally from the console but not when cron spawned it, you should check which environment variables your program need to run.
juanplacco
Senior Member
 
Posts: 318
Joined: Wed May 17, 2006 2:30 pm

Next

Return to QNX2 and QNX4

Who is online

Users browsing this forum: No registered users and 2 guests

cron