I have a clean up script which cleans up memory cleanup.sh
Script :
# root script starts here
echo ".........running clean up script ..........."
/usr/local/packages/aime/ias/run_as_root "su -"
free -t
sync; echo 1 > sudo /proc/sys/vm/drop_caches
free -t
sync; echo 2 > sudo /proc/sys/vm/drop_caches
free -t
sync; echo 3 > sudo /proc/sys/vm/drop_caches
free -t
swapoff -a && swapon -a
echo "#####swapoff and swap on command ############"
free -g
exit
# root script ends here
free -g
script end
The script uses root and doing the stuff but could not able come out of root prompt
i tried exit 0, exit 1 and {exit} all
the process is comming to foreground , how to gabck to the shell where i started this script
running the script and script staying just as root
[sgongali@slc06wvd cronjob]$ ./cleanup.sh
.........running clean up script ...........
[root@slc06wvd ~]#
after i give exit manually what i get is below Note that swapoff -a && swapon -a is not working as part of script but its working manually
[root@slc06wvd ~]# exit
logout
total used free shared buffers cached
Mem: 15037256 12776036 2261220 793448 382132 3357904
-/+ buffers/cache: 9036000 6001256
Swap: 15826924 0 15826924
Total: 30864180 12776036 18088144
total used free shared buffers cached
Mem: 15037256 12776036 2261220 793448 382140 3357896
-/+ buffers/cache: 9036000 6001256
Swap: 15826924 0 15826924
Total: 30864180 12776036 18088144
total used free shared buffers cached
Mem: 15037256 12776036 2261220 793448 382160 3357876
-/+ buffers/cache: 9036000 6001256
Swap: 15826924 0 15826924
Total: 30864180 12776036 18088144
total used free shared buffers cached
Mem: 15037256 12776104 2261152 793448 382164 3357872
-/+ buffers/cache: 9036068 6001188
Swap: 15826924 0 15826924
Total: 30864180 12776104 18088076
./cleanup.sh: line 14: swapoff: command not found
#####swapoff and swap on command ############
total used free shared buffers cached
Mem: 14 12 2 0 0 3
-/+ buffers/cache: 8 5
Swap: 15 0 15
[sgongali@slc06wvd cronjob]$