Exit Code issue

Hi,

I have created below script. If output.txt have any number more than 0 then i should get exit code 100 and if it is only 0 then fixlet status should be fixed or completed with exit code 0.

But in below case even it is 0 still my fixlet is getting failed with exit code 0. Kindly help me in this issue.

if {exists file “output.txt” whose (line of it as string contains => “0”) of folder (parameter “Error_Folder”)}
exit 100
endif

This is not valid relevance.

It is hard to know how this should be coded without some examples of acceptable and non-acceptable output.

I’m starting to wonder if this is an exam question somewhere - I’ve seen a lot of threads that are asking for help with generating an exit code of 100, driven by the contents of “output.txt” in {Error_Folder} :joy:

3 Likes

Hi,

Below is the complete script.

action parameter query “Error_Folder” with description “Please enter the Error Folder Name” with default value ""
action parameter query “Backup_Location” with description “Please enter Backup Location” with default value ""
action parameter query “Backup_File_Name” with description “Please enter Backup File Name” with default value ""
action parameter query “File_System_To_Exclude” with description “Please enter File System path to Exclude From Backup” with default value “”

if {not exists folder “Error_Folder”}
run mkdir -p {parameter “Error_Folder”}
endif

delete __createfile

createfile until EOF
#!/bin/bash
tar cvpf /{parameter “Backup_Location”}/{parameter “Backup_File_Name”} {parameter “File_System_To_Exclude”} --one-file-system / &> /{parameter “Error_Folder”}/error.txt
echo $? > /{parameter “Error_Folder”}/output.txt
EOF

delete backup.sh
move __createfile backup.sh

wait /bin/sh “backup.sh

if {exists file “output.txt” whose (line of it as string contains => “0”) of folder (parameter “Error_Folder”)}
exit 100
endif

You looks genius because your guess is correct, This was asked in exam. I will be happy if you(my teacher) will fix this issue. :grinning: