Protecting data on shared linux ubuntu laptop

I have share a laptop to test a custom application.  I will not have physical control of the machine and I'm uncertain what will happen to the laptop after the test.   My application is completely stored and run under a user directory.   Since, I'm not sure that I will get the laptop back after the test, is there a way to have the machine automatically purge my application after a certain time?  

For example:  All works fine for the first 24 hours, and then the app is deleted.
tmonteitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
mrjoltcolaCommented:
You don't have physical control of the laptop before the test either? If you never have physical control, you'd be forced to work within the confines of application domain (user space). So of course you could write some sort of watchdog app to remove itself after 24 hours. For more info on that option, you need to specify which language / environment you are using.
 
0
 
wesly_chenCommented:
> All works fine for the first 24 hours, and then the app is deleted.
1. record the first login time
edit your ~/.profile and add
------
if [ -s ~/.login_time ]
then
   touch ~/.login_time
else
   date +%s > ~/.login_time
fi

2. a shell script to check the first login time and delte the directory after 24 hours.
--- ~/bin/cleanup.sh ---
#!/bin/bash

DIR_TO_CLEAN=/path-to-the-app

FIRST_LOGIN_TIME=`cat ~/.login_time`
CURRENT_TIME=`date +%s`
TIME_DIFF=`expr $CURRENT_TIME - $FIRST_LOGIN_TIME`

# check if the time spend from the first login time greater than 86400 seconds
if [ "$TIME_DIFF" -gt "86400 ]
then
   /bin/rm -rf  $DIR_TO_CLEAN
fi
------
chmod +x
~/bin/cleanup.sh

3. Set up the cron job to run the script every 5 minutes
*/5 * * * * /home/<username>/bin/cleanup.sh > /dev/null 2>&1

4. Make sure the crond is running at boot time....
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
wesly_chenCommented:
Woo, typo

# check if the time spend from the first login time greater than 86400 seconds
if [ "$TIME_DIFF" -gt "86400" ]     # <== this line
then
   /bin/rm -rf  $DIR_TO_CLEAN
fi
0
 
Abhishek_ChibCommented:
use cron with :

find /path/to/files* -mtime +1 -exec rm {} \;

Put cron for specific date and time :

http://en.wikipedia.org/wiki/Cron
0
 
arnoldCommented:
Control the environment, which means bring your own laptop to demonstrate the application and then you either install it on their laptop/system after they decide to purchase it and then you can demonstrate that it is functional at the time (for the second time)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.