testing travis

This commit is contained in:
Dominic Breuker
2018-03-07 09:13:53 +01:00
parent a6d948819f
commit eb2fe0c668
5 changed files with 96 additions and 13 deletions

View File

@@ -0,0 +1,28 @@
#!/bin/bash
sudo cron -f &
sleep 1
sudo ps | grep cron 1>/dev/null
echo "[+] cron started"
echo "[+] Running as user `id`"
echo "[+] Executing test"
# exec /bin/bash
rm /home/myuser/log.txt
bin/pspy > /home/myuser/log.txt &
for i in `seq 1 25`; do
echo "Waiting for cron job detection..."
sleep 5;
QUERY_RESULT=$(grep ' | passwd myuser' /home/myuser/log.txt | grep -v grep)
if [ "'$QUERY_RESULT'" != "''" ]; then
echo "Cron job execution detected!"
echo "Complete log of pspy (may contain commands run in this test):"
cat /home/myuser/log.txt
exit 0
fi
done
echo "Failed to detect cron job..."
exit 1