Crontab execution failure

Good morning all,

On every Tuesday eve one of my allstarlink nodes connects our 220MHz repeater to the east coast Tuesday night tech net.

Been asked to add a link to our 145MHz repeater so the net would also be available on the 2m side via Echolink.

Added the second crontab to accomplish this (emboldened line below),

Join Tech net on east coast

59 19 * * TUE /usr/sbin/asterisk -rx “rpt fun 55xxx *327339”
*00 20 * * TUE /usr/sbin/asterisk -rx "rpt fun 55xxx 385xxxx"

The link dos not take place, but looking at the cron log

journalctl |grep CRON

Shows the command was called, but the link did not complete.

Nov 28 19:59:01 WR4AGC CROND[9082]: (root) CMD (/usr/sbin/asterisk -rx “rpt fun 55342 *327339”)
Nov 28 19:59:01 WR4AGC CROND[9081]: pam_unix(crond:session): session closed for user root
Nov 28 20:00:01 WR4AGC CROND[9199]: (root) CMD (/usr/local/bin/AUTOSKY/AutoSky)
Nov 28 20:00:01 WR4AGC CROND[9200]: (root) CMD (/usr/sbin/asterisk -rx “rpt fun 55342 *3855424”)

Then using Dougs Supermon2 interface connected manually, but would like to understand what/why the crontab did not successfully complete. As per forums post I found the 6 digit echolink node number needs to be prefixed with *3, so all would seem it would be set to execute…but alas no completion

Adriano (KV7D)

I see you asked in 2 place so for the benefit of others I will answer in both.

It looks to me like you are executing root crontab with user TUE

If user ‘TUE’ has root privileges, probably not the issue.

Perhaps google how crontab works for ‘users’.

Try using ‘root’ in place of ‘TUE’

After looking at this meticulously many times,
I see perhaps what is going on here.

I counted the number of entries for crontab for time selection.
One of your entries only has 4 plus TUE

First, use a number for day of the week.
0 = sunday and 6 = saturday / tuesday is 2 and missing

After the 5 digit calendar time entries, the next item is ‘user’ that the command is to execute as.

From system/root crontab I use root as that user unless I have good reason not to.
so

maybe should look like this

59 19 * * 2 root /usr/sbin/asterisk -rx “rpt fun 55xxx *327339”

and your next line

perhaps should look like this

* * 00 20  2 root  /usr/sbin/asterisk -rx "rpt fun 55xxx *385xxxx"**

But this does not specify a time for execution.

The format is
min hr dom moy dow user command

5 time / date entries, user, and command. - for system crontab

This is what you have:

59 19 * * TUE /usr/sbin/asterisk -rx “rpt fun 55xxx *327339”
*00 20 * * TUE /usr/sbin/asterisk -rx "rpt fun 55xxx 385xxxx"

This is what it should be:

59 19 * * 2 /usr/sbin/asterisk -rx “rpt fun 55xxx 327339”
00 20 * * 2 /usr/sbin/asterisk -rx "rpt fun 55xxx 3385xxxx"

to connect to echolink it should be *33 and then the node number 6 digits long if less than 6 digits then add 0’s to the front. ex 69145 would be *33069145

I don’t mean to hijack this thread but I have a question on this exact topic and instead of making a new thread why not ask that simple question here?

I have a few crontabs made for my node to connect and disconnect from certain nodes during the day. Some of them are only a certain day of the week and those work fine.
The problem I am having is when I want to connect for instance mon to fri I have the corn like this
00 15 * * 1-5
what about if it’s only tue and thu? 00 15 * * 2-4?
Is there a particular way that ASL looks for in a cron job?

ASL does not look in crontab.
It is run and maintained by the OS But can make calls back into asterisk with the command line executed.

Our software has a scheduler that will run a ‘macro’, and that can be any one or more complex command executions.
https://wiki.allstarlink.org/wiki/Scheduler_(ASL_System)
https://wiki.allstarlink.org/wiki/Macro_use_and_format
My suguestion is to use the softwares sched for asl stuff and the system cron for os stuff that only involve the system. Why anyone would want to go to the OS to make calls back into asterisk is beyond me.

That is mon - thurs

Mon - Fri is 1-5

System Cron uses system logical number in it’s numbering
and 0 is logical 1, not number 1, as the first number.
0=sunday and 6 = sat

You might be more use to that if you were interfacing or talking to hardware more.
Takes a while to remember that and causes some hair pulling for newcomers.
But if it is at OS level addressing, it’s normally the case.

I guess that was a typo. if 0 is sun then 1-5 is mon to fri?
I am using the scheduler on RPT with its respective macro, not a cron job I should have explained that better.
; SCHEDULES

[scheduleXXXXXX]
;dtmf_function = minute hour dayofmonth month dayofweek ; ala cron, star is implied
;1=00 * * * * ;run macro 1 on the hour
2=45 11 * * 1-5
3=30 13 * * 1-5
4=50 19 * * 5
5=00 21 * * 5
6=55 8 * * 1-5
7=20 10 * * 1-5
8=55 14 * * *
9=20 16 * * *
10=21 16 * * *
11=10 17 * * *

; MACROS

; Place command macros here

[macro518090]
;Macro number = command string (each command separated by space) -end with HASH
1=*81 *80# ; play time and voice ID
2=*3XXXXX#
3=*1XXXXX#
4=*3XXXXX#
5=*1XXXXX#
6=*3XXXXX#
7=*1XXXXX#
8=*3XXXXX#
9=*1XXXXX#
10=*3XXXXX#
11=*1XXXXX#
12=*73XXXXX#

Number 12 is actually my startup macro that’s why it doesn’t have a schedule, I remembered too late I did not have a startup after completing all my other schedules and didn’t think it would make a difference it was that low on the list of macros.

FB Alex,
Sorry if I am a bit confused (easy to do anymore), but are you still seeking answers ?
I’m guessing you found it with the macro 12 and startup, but didn’t want to leave you hanging.

If so, perhaps re-phrase it.

I just wanted for you to look at my schedules and macros and see if they were right. It is the first time I have used a schedule that involved a multi-day and I wasn’t sure if the syntax was correct. Single days or everyday schedules are easy but wasn’t sure about the multiday.

FB,
Well, it is harder to look for something when there is no exact target. Easy miss.

But yes, the sched looks fine.

I guess what you should look for is the number of entries first, as there should be 5 per item. + macro
That is where most fat finger them.

The only extra guidance I might have would be early on to make your macro numbers jump by 10/100 so you can keep macro’s organized by type.
ie system maintenance, remote connections and announcements for that etc

At one time I had a slew of them, but not everybody does the same stuff

Useful when you have accumulated a bunch and debugging.
After you have a bunch, you will not want to do it. To much work.

OH…
startup macro might look like this…

startup_macro=*9401 *9410 *31951 ;*59999 ; Macro to run at startup (optional) (no # reqd)

1 Like

Change your days to 2,4 you can use crontab.guru and check your results.