Forgive me.. I have looked through many suggestions, but can't seem to solve my issue with cron.
I am using a Raspberry Pi 3, running the latest default OS (Debian).
I have installed Python 3.
I have attempted to run the script at https://github.com/darksidelemm/spot2ap ... ot2aprs.py using cron.
Initially I attempted to run the Python script directly from cron using a cron entry like this:
*/10**** sudo python spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB /
in crontab -e and via sudo crontab -e
I also tried this
*/10**** sudo /usr/bin/python /home/kimberly/spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB
in crontab -e
I could get the commands to run from the shell but not via cron. Knowing that cron can be fussy about such things and not being too familiar with these things, I elected to create a bash script and run it from cron, but that did not work either.
So what I have is a bash script called runspot2aprs.sh in /home/kimberly. The Python script (spot2aprs.py) resides in /home/kimberly
which python returns /usr/bin/python
Both crontab -e and sudo crontab -e have the following entry /10*** runspot2aprs.sh.
I have restarted cron and rebooted, but nothing seems to happen.
If I run bash runspot2aprs.sh it works fine from the shell. Bothe crips have been made executable
bash script details
#!/bin/bash echo started /usr/bin/python3.9 /home/kimberly/spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB echo completed
Further
If I edit crontab via the command sudo nano /etc/cron, I see a completely different crontab
it looks like this
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Note the spaces!
I added the lines
5 * * * * sudo /bin/bash runspot2aprs.sh
#
Still no luck
Perhaps I should pose this as a series of questions-
1. Given the above, should I edit crontab via sudo nano /etc/cron or should I edit via sudo crontab -e or via contab -e?
2. If which python returns /usr/bin/Python, and the python script is located at /home/kimberly/spot2aprs.py, what would my full path crontab entry look like to run spot2aprs.py every two minutes, using the format ...... spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB echo completed
3. Or would I be better to have cron run the bash script? If so
4. What would my full path crontab entry look like to run runspot2aprs.sh which is located in /home/kimberly/
I am using a Raspberry Pi 3, running the latest default OS (Debian).
I have installed Python 3.
I have attempted to run the script at https://github.com/darksidelemm/spot2ap ... ot2aprs.py using cron.
Initially I attempted to run the Python script directly from cron using a cron entry like this:
*/10**** sudo python spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB /
in crontab -e and via sudo crontab -e
I also tried this
*/10**** sudo /usr/bin/python /home/kimberly/spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB
in crontab -e
I could get the commands to run from the shell but not via cron. Knowing that cron can be fussy about such things and not being too familiar with these things, I elected to create a bash script and run it from cron, but that did not work either.
So what I have is a bash script called runspot2aprs.sh in /home/kimberly. The Python script (spot2aprs.py) resides in /home/kimberly
which python returns /usr/bin/python
Both crontab -e and sudo crontab -e have the following entry /10*** runspot2aprs.sh.
I have restarted cron and rebooted, but nothing seems to happen.
If I run bash runspot2aprs.sh it works fine from the shell. Bothe crips have been made executable
bash script details
#!/bin/bash echo started /usr/bin/python3.9 /home/kimberly/spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB echo completed
Further
If I edit crontab via the command sudo nano /etc/cron, I see a completely different crontab
it looks like this
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Note the spaces!
I added the lines
5 * * * * sudo /bin/bash runspot2aprs.sh
#
Still no luck
Perhaps I should pose this as a series of questions-
1. Given the above, should I edit crontab via sudo nano /etc/cron or should I edit via sudo crontab -e or via contab -e?
2. If which python returns /usr/bin/Python, and the python script is located at /home/kimberly/spot2aprs.py, what would my full path crontab entry look like to run spot2aprs.py every two minutes, using the format ...... spot2aprs.py --verbose --maxage 120 VK2KMI-7 23211 0K289Fo6vPYIf1YDnagVsPaUKfUAEEtEB echo completed
3. Or would I be better to have cron run the bash script? If so
4. What would my full path crontab entry look like to run runspot2aprs.sh which is located in /home/kimberly/
Statistics: Posted by vk2kmi — Tue Feb 27, 2024 7:27 pm — Replies 1 — Views 29