Jump to content

Noob Cron Help


telot

Recommended Posts

Anyone here use the cron on the pineapple? I can't seem to get it to work. Heres my crontab entry from the 'Jobs' gui:

*/5 * * * * /www/pineapple/scripts/cleanup.sh

*/5 * * * * /www/pineapple/ssh/ssh-keepalive.sh

*/5 * * * * /usb/pinesave/telotreport.sh

Inside /usb/pinesave/telotreport.sh:

#!/bin/bash

TODAY=$(date +"%m-%d-%y")

rm /usb/emailreport.log

du -h /usb/cap.$TODAY.pcap > /usb/emailreport.log

cat /www/pineapple/logs/associations.log >> /usb/emailreport.log

cat /www/pineapple/logs/urlsnarf.log >> /usb/emailreport.log
./usb/killurlsnarf.sh
./usb/starturlsnarf.sh
cat /www/pineapple/logs/dnsspoof.log >> /usb/emailreport.log

cat /proc/net/arp >> /usb/emailreport.log

cat /tmp/dhcp.leases; echo '\n'; cat /proc/net/arp; echo '\n'; grep KARMA /tmp/karma.log | grep -v -e enabled | grep -v -e malloc | grep -v -e CTRL_IFACE | grep -v -e KARMA_STATE | grep -v -e Request >> /us$

ssmtp -v telot@telotsemail.com < /usb/emailreport.log

I know, I know, its a very rough draft of my email reports module I'll make someday. So as you can see, I remove the old log, take a size reading on today's capture file, cat the urlsnarf.log and restart it, then cat a bunch of other things and email it off. Just running the script works great - I get the email and its got all the goodies in it. I was hoping to get this to be sent to me every hour or two, but wanted to test it on 5 minute intervals. Most unfortunately I don't ever receive any emails. So I ran a test - I put a script in /www/pineapple/scripts/ called test.sh - in it is simply:

#!/bin/sh
touch /www/testthis

I added it to the cron (again, on the Jobs page) for 5 minute intervals - now it looks like this:

*/5 * * * * /www/pineapple/scripts/cleanup.sh

*/5 * * * * /www/pineapple/ssh/ssh-keepalive.sh

*/5 * * * * /www/pineapple/scripts/test.sh

Came back 6 minutes later and ls /www/ and testthis is there. So what is stopping telotreport.sh from working? They're both chmod +x'd - same permissions as the cleanup.sh script. Any advice would be greatly appreciated. Thanks guys

telot

Link to comment
Share on other sites

I use cron for the ddns module.

I know during the Mk4 2.1 beta cron had to be restarted manually to get new jobs to run. (This is fixed now in Mk4 2.1 final)

Not to say you did not but did you wait for 5min (10min)? (I think your 5min job will be scheduled with the cleanup and ssh-keepalive)

Other than that, no clue what it is doing.

Link to comment
Share on other sites

Just my 2c: I did a module, logcheck, which can filter the pineapple log for any information you're looking for and also a custom script part, all this sent by email every 30 minutes (can be changed on the jobs page).

You could use the custom part with your script, without the last line ssmtp :)

I know, I do not help you much with your issue though :mellow:

Maybe something to look at: I had problems for some of my modules with scripts using bash (#!/bin/bash) and changed to sh (#!/bin/sh). I don't know if it is the problem in your case.

Edited by Whistle Master
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...