IQSS / dataverse-jenkins

configs and docs for running continuous integration for Dataverse in Jenkins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

script to delete files in /tmp from different user

pdurbin opened this issue · comments

Until IQSS/dataverse#5885 is fixed properly I'm wondering if I can have a script to run as a non-privileged user (e.g. "pdurbin") on https://jenkins.dataverse.org to delete files created by other users (e.g. "jenkins") in /tmp such as these:

/tmp/sitemap.xml
/tmp/sushi_sample_logs.json
/tmp/dvjsonld.json

I'm not sure how many there are, to be honest.

To make this a little more concrete, I think what I want is for something like sudo apitesttmpclean.sh to delete the files, as in the example below.

[pdurbin@gdcc-jenkins dataverse]$ ./apitesttmpclean.sh 
rm: remove write-protected regular file ‘/tmp/dvjsonld.json’? y
rm: cannot remove ‘/tmp/dvjsonld.json’: Operation not permitted
rm: remove write-protected regular file ‘/tmp/sitemap.xml’? y
rm: cannot remove ‘/tmp/sitemap.xml’: Operation not permitted
rm: remove write-protected regular file ‘/tmp/sushi_sample_logs.json’? y
rm: cannot remove ‘/tmp/sushi_sample_logs.json’: Operation not permitted
[pdurbin@gdcc-jenkins dataverse]$ 
[pdurbin@gdcc-jenkins dataverse]$ sudo apitesttmpclean.sh 
[sudo] password for pdurbin: 
pdurbin is not in the sudoers file.  This incident will be reported.
[pdurbin@gdcc-jenkins dataverse]$ cat apitesttmpclean.sh 
#!/bin/sh
rm /tmp/dvjsonld.json
rm /tmp/sitemap.xml
rm /tmp/sushi_sample_logs.json
[pdurbin@gdcc-jenkins dataverse]$

Jenkins is whirring away, so I've disabled this script. Closing.