Action Script: relevance error createfile- (Substitution failed while writing file)

Hi
I am currently writing an action script which should get all lines starting with a specific date and write it into the __createfile. The output is needed for further checks.

Code Snippet:
if {name of operating system as lowercase does not start with “win”}
parameter “dsmsched_log” = "/var/tmp/tsmlog/dsmsched.log"
else
parameter “dsmsched_log” = "c:\adsm\baclient\dsmsched.log"
endif

parameter “date” = "{(day_of_month of it as two digits & “.” & month of it as two digits & “.” & year of it as string) of (current date)}"
parameter “date1” = "{(day_of_month of it as two digits & “.” & month of it as two digits & “.” & year of it as string) of (current date - 1day)}"
parameter “date2” = "{(day_of_month of it as two digits & “.” & month of it as two digits & “.” & year of it as string) of (current date - 2
day)}"
parameter “date3” = “{(day_of_month of it as two digits & “.” & month of it as two digits & “.” & year of it as string) of (current date - 3day)}"
parameter “date4” = "{(day_of_month of it as two digits & “.” & month of it as two digits & “.” & year of it as string) of (current date - 4
day)}”

if {name of operating system as lowercase does not start with “win”}

createfile until _end
{concatenation “%0a” of lines whose (it starts with (parameter “date4”) OR it starts with (parameter “date3”) OR it starts with (parameter “date2”) OR it starts with (parameter “date1”) OR it starts with (parameter “date0”) OR it starts with (parameter “date_4”) OR it starts with (parameter “date_3”) OR it starts with (parameter “date_2”) OR it starts with (parameter “date_1”) OR it starts with (parameter “date_0”)) of file (parameter “dsmsched_log”)}_end

else

createfile until _end
{concatenation “%0d%0a” of lines whose (it starts with (parameter “date4”) OR it starts with (parameter “date3”) OR it starts with (parameter “date2”) OR it starts with (parameter “date1”) OR it starts with (parameter “date0”) OR it starts with (parameter “date_4”) OR it starts with (parameter “date_3”) OR it starts with (parameter “date_2”) OR it starts with (parameter “date_1”) OR it starts with (parameter “date_0”)) of file (parameter “dsmsched_log”)}_end

endif


I think the code is fine and also works in the Fixlet Debugger and also on several target servers (unix & windows). But still there are around 100 out of 1600 servers which has a problem with this. The servers have mostly the same setup and the same error appears on both windows and unix servers. Somehow those servers have a problem with reading file and writing it to __createfile. I have checked permissions and file types - but without success. I tried also to read other files and this worked mostly. I don’t know what the problem could be on the dsmsched.log files…

Error Message:
Command failed (Substitution failed while writing file) createfile until _end

Any idea what maybe is causing the code to fail?

Thanks for any help,
Amir Michael

Can you do any other operation on this log file? How about copying it into another file?

I agree with Marjan’s comment. I’ve encountered the same.

If the TSM Client Scheduler service happens to be running at the time, it holds a lock on the dsmsched.log file and the file cannot be accessed in Relevance.

To work around it, I use an action to copy the file to a backup file path, and parse the backup copy in relevance.

Hi

Thank you for your proposed solution.

I have done a test successfully on one AIX server today. I will try to do it on more servers in the coming days and will give a feedback again. Thanks!

I can confirm that the proposed solution helped (coping log file to backup path first) and the script is working now on UNIX & Windows servers.

But here is still a small issue anyways: I had the situation that on couple of servers the script ran successfully but when I reran the script again some hours later, I again received the “Substitution failed while writing file” error. I have the feeling that on a couple of servers the action is very inconsistent. Any idea what the problem could be?

I noticed in your original post you have the “__end” on the same line as the relevance statement. Generally this is on its own line so not sure if that is causing any issue.

The error message suggests you got a relevance error during the writing of the createfile. This could mean you have no answers to provide on some machines. When you try the relevance through qna what do you get on a failing machine?

Again, it’s likely because the TSM Client Scheduler happened to be running at the time and has a lock on the log file.

TSM is different from many other backup solutions in that it uses several services (by default). The TSM Client Acceptor Daemon (CAD) service is generally set to Automatic start. This service will periodically start the TSM Client Scheduler (Schedule) service. The Schedule service checks in with the TSM server, downloads the next backup schedule, and then stops itself (if the scheduled time has not yet arrived).
While the Schedule service is running Bigfix cannot examine the log file and will throw an error if you try to read ‘lines of it’.

Try this to illustrate…

(if exists (file it) whose (exists lines of it) then (...your query) else ("dsmsched.log unreadable")) of parameter "dsmsched_log"

Hi Jason

This really helped. I have adjusted the script and tested successfully.

Thank you