Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dir_data="/home/test/.fortcronjob/"
- if [ $# != 2 ]
- then
- echo "Usage: unique_id week_modulus"
- exit 1
- fi
- instance_id=$1
- instance_mod=$2
- counter=0
- exit_value=1
- file_data="$dir_data$1"
- if [ ! -e "$file_data" ]
- then
- echo "id:$instance_id - no data, starting from 0"
- else
- source "$file_data"
- fi
- counter=$(( $counter % $instance_mod ))
- if [ $counter == 0 ]
- then
- echo "id:$instance_id - true"
- exit_value=0
- else
- echo "id:$instance_id - t-$(( $instance_mod - $counter ))"
- fi
- counter=$(( $counter + 1 ))
- echo "counter=$counter" > "$file_data"
- exit $exit_value
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement