Skip to content

Conversation

@mpatsis
Copy link

@mpatsis mpatsis commented Nov 22, 2019

Fixed script name for sinline as the original name caused failure.
Maybe it was a special snowflake.

@mpatsis mpatsis requested a review from JamesOwers November 22, 2019 17:15
Copy link
Member

@JamesOwers JamesOwers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, as we discussed(!), I think this error is because the file already existed and, since somebody else made it, you get a permissions error because you can't overwrite it.

My proposed solution is to simply add the datetime to the filename, e.g.:

dt=$(date '+%d_%m_%Y__%H_%M_%S')
/tmp/bash_script_${dt}.sh

If that works for you, please may you add the change and I'll approve. 😘

@RyanrDavies
Copy link
Contributor

Might be worth putting the username in the filename as well, just in case two people happen to run in the same second? (Probably unlikely, but it's an easy thing to add in advance)

@JamesOwers
Copy link
Member

Might be worth putting the username in the filename as well, just in case two people happen to run in the same second? (Probably unlikely, but it's an easy thing to add in advance)

Good shout

Adds the current date/time and username of the submitting user to the name of the temporary file created. This should avoid issues where the temporary file cannot be created because it already exists and belongs to another user.
@RyanrDavies
Copy link
Contributor

Have changed the code to add date/time/username to the file name, but have not tested it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants