Hello,
could you please help me with the following request?
I need a linux command script that does the following.
-
delete folders folder1 and folder2 located in install/users/web/folder1&2.
and also delete folder3 install/jboss/server/folder3. All these folders has many folder and files inside.
-
Reboot the machine
-
Then start a cron job called "test.cron"
basically the script should do deleting folders then reboot the machine then start a cron job.
Thanks in advance
Ken
There's a problem. Scripts do not persist across a reboot because all processes stop existing.
What do you mean by a 'start a cron job'? - cron runs at fixed intervals, so 'start a cron job' means make a cron entry using a script. And then hope it runs, I guess. Which in my opinion is a bad idea.
1. delete folders folder1 and folder2 located in install/users/web/folder1&2.
and also delete folder3 install/jboss/server/folder3. All these folders has many folder and files inside.
You did not give a full path. I am assuming that install is off the root - the fule path starts with: /install
#!/bin/bash
# this script has to run as the root user
cd /install/user/web
rm -R folder1
rm -R folder2
cd /install/jboss/server
rm -R folder3
reboot -v
Before we show any more code, please explain what you want done, not how you decided to do it. Example: "I want to be sure cron works correctly after the reboot."