-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mimi1vx/poo_138491_2
Add test case for success on last retry
- Loading branch information
Showing
2 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Set the path to the file that will store the run count in /var/run directory | ||
count_file="run_count.txt" | ||
|
||
# Initialize the count file if it doesn't exist | ||
if [ ! -f "$count_file" ]; then | ||
echo "0" > "$count_file" | ||
fi | ||
|
||
# Read the current run count from the file | ||
run_count=$(<"$count_file") | ||
|
||
# Increment the run count | ||
((run_count++)) | ||
|
||
# Write the updated run count back to the file | ||
echo "$run_count" > "$count_file" | ||
|
||
# Check if it's the third run and exit with an error if true | ||
if [ "$((run_count % 3))" -gt 0 ]; then | ||
echo "Failing on the run!" | ||
exit 1 | ||
fi | ||
|
||
# Your script logic goes here | ||
echo "Script is running successfully on run $run_count" |