Open Linux Forums
Like Ubuntu forums, except with beer.
Member
Joined: Oct 06 2017
Posts: 179

Hi. I have this script ( it's the cleanup script from tgeer back on the old forum) and I'd like to make a starter for it. In a terminal that is. The thing is, when I start it within my normal terminal, it runs, however, halfway it aborts. Now, if I run it in a gksu terminal it reads to the end. So, how do I make a gksu starter pointing directly to that script?

Member
Joined: Oct 06 2017
Posts: 179

Edit: Weird. I normally use lxterminal so I decided to try roxterm which supports drag 'n drop. Sooo...I opened up a roxterm, dropped the script in and.....it works. The normal -e command for both lxterminal and roxterm doesn't.
`

Member
Joined: Oct 06 2017
Posts: 179

Perhaps someone can tell me how to open that script in a terminalby default? Which line can I add to the script to do that?

Member
Joined: Oct 06 2017
Posts: 179

This gets weirder and weirder. The drag 'n drop option only works when the script is on the desktop, not when dragging the script from within the scripts' folder. Anyway, got it working with xterm since that one has a hold function, as to not to close the terminal when the script has finished./usr/bin/xterm -hold -e /home/john/Scripts/cleanup.sh

Member
Joined: Oct 06 2017
Posts: 179

Problem solved. Got a starter using a xfce4-terminal.

Moderator
Joined: Oct 04 2017
Posts: 1244

Is this for cleaning? Could you setup a bash script for the gksu in the bash.rc using an alias or is this something totally different and I misunderstood?

Member
Joined: Oct 06 2017
Posts: 179

Yep, it's a cleaning script. Wait...

Member
Joined: Oct 06 2017
Posts: 179
# cleanup.sh - a script to automate system housekeeping chores
#           
# author: Tom Geer - tgeer43 on http://openubuntu.com
#         Please use the forums for support!
#
# currently this simple maintenance script performs the following functions:
#   > apt-get clean
#   > apt-get autoclean
#   > apt-get autoremove
#   > apt-get purge
#   > delete orphaned packages
#   > delete residual config files
#   > delete thumbnails (current user)
#   > delete thumbnails (root)
#   > delete mozilla cache (current user)
#   > delete mozilla cache (root)
#   > delete trash (current user)
#   > delete trash (root)
#
# requires the following packages in addition to those provided by a default Ubuntu installation:
#   > deborphan (for identifying orphaned packages) - to install, type: sudo apt-get install deborphan
#   > wajig (for purging residual config files) - to install, type: sudo apt-get install wajig
#
# NOTES:
#
# 1) This script assumes that certain files/folders are in their default Ubuntu locations. If you are
#    getting 'No such file or directory' errors then look through the script below to see if your
#    files/folders are located where the script is expecting them and edit as necessary.
# 2) The goal of this script was to do a system cleanup as quickly and efficiently as possible. Some
#    functions do require confirmation but some run without user input. Because of this and the fact
#    that this script's primary purpose is to delete data from your hard drive, it should be used with
#    caution. THE ACTIONS OF THIS SCRIPT CAN NOT BE UNDONE. If you do not understand all of the
#    functions listed above, it is suggested that you gain a passing knowledge of each. The Ubuntu man
#    pages, Google search, and openubuntu.com will provide more than enough information.
# 3) The reason for deleting some files in /root may not be obvious. Picture this scenario. You open a
#    nautilus session as administrator where you send some image files to the trash and look something
#    up on the internet. Now you have created thumbnail files and mozilla cache files saved under /root
#    and the files that you trashed are sitting in /root/.local/share/Trash/files/. All of these files
#    are easily forgotten and require root access to delete when doing a manual cleanup.
# 4) This script requires a one-time setup which is as easy editing three lines listed immediately
#    below to provide information to enable the script to find your files/folders. After editing and
#    saving the file make sure that the file is executable by setting the permissions in nautilus or
#    by typing: sudo chmod +x /path/to/file/cleanup.sh
#

Edit: looks like you were trying to paste a script. Use code blocks to prevent undue formatting. -Sam

Member
Joined: Oct 06 2017
Posts: 179

Damn, can't change the font-size.

Member
Joined: Oct 06 2017
Posts: 179

Anywho..you don't have to use a rootterminal as such. The scripts asks you for your password. I like it. You can make an alias, a bash , a desktop application.....whatever to run it.