pucherot / Pi.Alert

WIFI / LAN intruder detector. Check the devices connected and alert you with unknown devices. It also warns of the disconnection of "always connected" devices
GNU General Public License v3.0
1.98k stars 122 forks source link

Feature Request: Move cron to cron.d directory #69

Open wardy277 opened 3 years ago

wardy277 commented 3 years ago

I have installed pihole and this on a mini pc i use as a basic home server. This is running ubuntu, so no a pi distro.

Only issue I have encountered is that the cron is installed in the user's crontab, but the scripts usesd relies on sudo. sudo asks for a password prompt so doesnt work for the user on my server

I moved the crons to /etc/cron.d/pialert in the global cron format (sets user to run against) e.g:

PIALERT_HOME="/home/user"
0 3 * * 1      root python3 ${PIALERT_HOME}/pialert/back/pialert.py update_vendors >${PIALERT_HOME}/pialert/log/pialert.vendors.log  2>&1
eugef66 commented 3 years ago

I was about to create the same issue. After installation cron jobs created in current user's cron and executed as installation user, however arp_scan requires "sudo" to run per code below:

_arpscanargs = ['sudo', 'arp-scan', '--localnet', '--ignoredups', '--retry=' + str(pRetries)]

As a result jobs failing with permission denied which indicated in log file. I had to move jobs to root cron ("sudo crontab -e") in order for them to run.

pucherot commented 3 years ago

correct, it is true. sorry for the mistake I will fix it shortly