update smbclient to install the script and create the cron job
This commit is contained in:
17
roles/smbclient/files/smb-session.sh
Executable file
17
roles/smbclient/files/smb-session.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
file=$(i=$RANDOM
|
||||||
|
if [ $i -lt 16384 ]; then echo 'test_file_100M'
|
||||||
|
elif [ $i -lt 24566 ]; then echo 'test_file_200M'
|
||||||
|
elif [ $i -gt 29490 ]; then echo 'test_file_1G'
|
||||||
|
else echo 'test_file_500M';
|
||||||
|
fi)
|
||||||
|
|
||||||
|
if pgrep -f test_file >/dev/null
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
cp /media/smb/$file /home/pi/Documents/smb/all_files_$HOSTNAME.zip
|
||||||
|
cp /home/pi/Documents/smb/all_files_$HOSTNAME.zip /media/smb/
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -7,3 +7,11 @@
|
|||||||
weekday: "1-5"
|
weekday: "1-5"
|
||||||
job: "/usr/bin/perl -e 'sleep int rand 1199' && /home/pi/scripts/smb-session.sh"
|
job: "/usr/bin/perl -e 'sleep int rand 1199' && /home/pi/scripts/smb-session.sh"
|
||||||
tags: smbtraff_cron
|
tags: smbtraff_cron
|
||||||
|
- name: copy smb-session.sh to scripts directory
|
||||||
|
copy:
|
||||||
|
src: "{{ role_path }}/files/smb-session.sh"
|
||||||
|
dest: /home/pi/scripts/smb-session.sh
|
||||||
|
owner: pi
|
||||||
|
group: pi
|
||||||
|
mode: a+x
|
||||||
|
tags: smbtraff_script
|
||||||
|
|||||||
Reference in New Issue
Block a user