My scripts for home use. Work in Debian. It is may help you.
This scripts is only home use on GPL 3.0 lisense. Scripts used and tested on my Debian 11 xfce.
All scripts contain from 3 folders.
Specific scripts:
Test: Path to lib.sh must be $HOME/.MYSCRIPTS/lib.sh.
Add string:
PATH="$PATH:$HOME/.MYSCRIPTS"
to file $HOME/.bashrc
Test: After reload system. If you print "," in terminal all my scripts and aliase should be shown. An alias differs from a script in that it does not have a ".sh" at the end of the name.
Add job to crontab. Command to add "crontab -e". The command "crontab -l" should look like this:
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:<path_to_home>/.MYSCRIPTS
* * * * * <path_to_home>/.MYSCRIPTS/every_minutes.sh
- its not variable, its full path from root. Example /home/a/.MYSCRIPTS.
Test: Every minutes must be created and deleted lockfile /tmp/lockfile_every_minutes.
ATTENTION: Some scripts may fail because they are customized for me or don't have the correct paths or because they don't have the right applications. Therefore, just comment them out in every_minutes.sh. An Error.log file will appear on the desktop, which will indicate the script that did not work correctly and the line where the error occurred.
Add item "Setting" - "Session and Startup" - "Application Autostart" - "+" with this arguments:
Name: every_start_os.sh
Description: Start every_start_os.sh
Command: <path_to_home>/.MYSCRIPTS/every_start_os.sh
Trigger: on login.
- its not variable, its full path from root. Example /home/a/.MYSCRIPTS/every_start_os.sh
Test: Programms included in every_start_os.sh must be started.
ATTENTION: Some programs may not start because you do not have them. Just remove what you don't need and add what you need in the every_start_os.sh. Don't forget to add "&" at the end of each line.
When run, most scripts create a lockfile /tmp/lockfile_script. This is done so that the scripts are executed in turn. No script will be run twice at the same time. After script work finished the lockfile /tmp/lockfile_script is deleted.
Also, running the script every_minutes.sh creates a lockfile /tmp/lockfile_every_minutes. This is done so that this script is not launched several times at the same time. After script every_minutes.sh finished the lockfile /tmp/lockfile_every_minutes is deleted.
This file contains all the used functions. Its included in script "source $HOME/.MYSCRIPTS/lib.sh".
Functions are divided into simply functions, denoted by "fun_" at the beginning of the name.
And conditional functions, denoted by "con_" at the beginning of the name. Conditional functions terminate the script execution if the condition is not met. But unlike functions fun_analize_command, they do not cause an error and stop the work of all scripts.
#_sudo_apt_install_
#_sudo_dpkg_i_
These tags are required to write the necessary packages for this script to work. First tag specifies the packages to be installed from the repository. Second tag packages to manually install from folder. Use command to see all the packages that need to be installed for all scripts:
grep -r "#_sudo_apt_install" ~/.MYSCRIPTS/"
In the script speech.sh setup language variable "lang". Posible variants: "ru" or "en". Example:
lang="en"
,backup_data1.sh - this script for pack, encrypt my temp data from backup folder. After they are manually copied to the cloud.
,create_playlists.sh - this script for create playlist to Ace Stream Player. Used php scripts. See more http://omt56v4jxa4hurbwk44vqbbcwn3eavuynyc24c25cy7grucjh24q.b32.i2p/trash/ttv-list/
,sync_ftp.sh - this script for lfpt sync Its copied data from my mobile devices to PC.
convert - this folder contain convert files.
,backup_data2.sh - this script for pack, encrypt my documents. The script only works if the checksum of the document folder has changed. After they are manually copied to the cloud.
,file_delete_notify.sh - this script prints to the Desktop a list of deleted files in a specific folder. Useful for the documents folder so you don't accidentally delete the files you need.
,sync_rsync.sh - this script for synchronizing folders between logical drives. This is used for backing up documents.
every_minutes.sh - see point 2.
,backup_folders.sh - this script for manualy pack, encrypt different folder. May backup root folder.
,find_files.sh - this script to search for files in pre-installed folders.
,timer_today_info.sh - this script announces the current time, the uptime of the current session and the uptime for the whole day by voice messages.
every_start_os.sh - see point 2.
,backup_open_data.sh - this script copies new files to a folder for later upload to the cloud. New files are files created after the specified date.
,find_string.sh - this script to search for string in pre-installed files. May use 4 arguments for search.
,translate-shell.sh - this script does a translation based on the translate-shell application.
lftp - this folder contain config file for lftp app.
,backup_to_cloud.sh - this script is just a simple shell to run ,backup_data1.sh, ,backup_data2.sh and ,backup_open_data.sh. Launches monthly.
,move_configs.sh - this script is to move manually created files to desired folders.
,transmission_controller.sh - this script controls the transmission client. He finds a new torrent. Informs about its readiness by voice message. Then checks the torrent. The floor after the distribution is completed deletes the torrent. Deletes only the torrent, not the data.
lib.sh - see point 2, 5.
,clean.sh - this script cleans the computer from unnecessary files.
,rkhunter.sh - this script to check the computer using rkhunter.
,upgrade.sh - this script for upgrade Debian OS.
list - this folder contain lists files for rsync app.
,conky_weather.sh - this script gets the weather forecast and prints it out using conky.
,rsync_no_e24.sh - this is an intermediate script for synchronization, but ignoring error 24.
,wallpaper_changer.sh - this is a script to change wallpaper in xfce. With the arguments "del" file, the disliked wallpaper can be deleted.
opt - this folder contains scripts for various purposes that are not constantly used.
,correct_disks.sh -this script adjusts the space of logical disks. When the volume exceeds the minimum allowable value, the script deletes the oldest file from the specified folder. Deletion occurs until the volume of the logical disk is below the minimum allowable value. Inside folders, not the oldest files are deleted, but the files with the lowest name. This is done so that the series first deleted episode 1, and then 2.
,rsync_torrent_to_MediaX.sh - this script moves torrents to a MediaX folder. Normal relocation occurs, but files ending with "*.part" are not ignored.
,xdotool_getmouselocation.sh - this script to get mouse coordinates and write them to a file. Used with hotkeys.
uptime_counter.sh - this script calculates the uptime for the whole day. The calculation is based on London time, since the change of date there exactly falls on the time when I sleep in my time zone.
,correct_tvbox.sh - this script adjusts the folder size on the tv box. If the size is exceeded, the script deletes the oldest file. Deletion occurs until the size is less than the minimum allowable size.
,shutdown.sh - this script to shutdown the computer. This is only executed when other scripts are not running.
,cp_to_flash59gb.sh - this script moves torrents to a flash drive. Normal relocation occurs, but files ending with "*.part" are not ignored.
,speech.sh - this script speaks all arguments on the command line. If there are no arguments, then he is silent. If the argument is OK it says "Операция выполнена".
config - this folder contains configuration files for other apps etc conky, bash_aliases.
echo_nostromo.sh and nostromo.ogg - this script prints as the computer from the ship "Nostromo" printed in the movie "Alien".