jacknpoe

Backup Script

Nov 19th, 2025 (edited)
646
0
Never
23
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.82 KB | Software | 0 0
  1. #!/bin/bash
  2.  
  3. ######### Backup script for important folders of the user jacknpoe (+ pages in htdocs) #########
  4.  
  5. # this function performs echo and log simultaneously
  6. d_echo() {
  7.     local message=$1
  8.  
  9.     # echo to the terminal
  10.     echo "$message"
  11.  
  12.     # log to the file
  13.     echo "$message" >> "$log_file"
  14. }
  15.  
  16. # this function summarizes many things to make copying folders easier
  17. copy() {
  18.     local origin=$1
  19.  
  20.     # keeps the initial time for copy duration calculation
  21.     ini_cp_time=$SECONDS
  22.  
  23.     # increments the current copy number
  24.     present_copy=$((present_copy + 1))
  25.  
  26.     # separates only the folder name, ignoring the path
  27.     folder=$(basename "$origin")
  28.  
  29.     # informs the start of the copy
  30.     d_echo "$present_copy: copying from \"$folder\"..."
  31.  
  32.     # these spaces are used to align the script output, depending on the current copy number
  33.     digits=${#present_copy}
  34.     size=$(($digits + 2))
  35.     spaces=$(printf "%0.s " $(seq 1 $size))
  36.  
  37.     # first check if the source exists (ChatGPT)
  38.     if [[ ! -d "$origin" ]]; then
  39.         fails=$((fails + 1))
  40.         d_echo "$espacos(folder \"$pasta\" does not exist)"
  41.         return
  42.     fi
  43.  
  44.     # performs the copy with rsync, without symbolic links (+ ChatGPT)
  45.     rsync -a --no-links "$origin" "$dest_path" >> "$log_file" 2>&1
  46.  
  47.     # check the exit code of the rsync command and update the counters of successes and fails
  48.     if [ $? -eq 0 ]; then
  49.         successes=$((successes + 1))
  50.         d_echo "$spaces(\"$folder\" copy completed successfully)"
  51.     else
  52.         fails=$((fails + 1))
  53.         d_echo "$spaces(\"$folder\" copy failed)"
  54.     fi
  55.  
  56.     # calculates the elapsed time of the copy and informs
  57.     elps_cp_time=$((SECONDS - ini_cp_time))
  58.     d_echo "$spaces(time: $((elps_cp_time / 60)) minutes and $((elps_cp_time % 60)) seconds)" && d_echo
  59. }
  60.  
  61. # interrupted by user (ChatGPT)
  62. trap 'd_echo "Backup interrupted by user."; exit 130' INT
  63.  
  64. # gets the folder name from the argument, if any
  65. dest_folder=$1
  66.  
  67. # if the folder name is missing as an argument, it prompts the user
  68. if [[ -z "$dest_folder" ]]; then
  69.     # it asks for the folder name, otherwise it will be backup_YYYY_MM_DD_HH_MM_SS
  70.     read -p "Backup folder name (nothing to 'backup_YYYY_MM_DD_HH_MM_SS'): " dest_folder
  71. fi
  72.  
  73. # these folders are the largest among the candidates for backup, which should be done eventually
  74. # note that it doesn't wait to press enter; just pressing 'y' or another key continues
  75. read -n 1 -r -p "Copy 'do dropbox' too? (y/n): " r_dropbox
  76. echo
  77.  
  78. read -n 1 -r -p "Copy 'Linguagens' too? (y/n): " r_linguagens
  79. echo
  80.  
  81. read -n 1 -r -p "Copy 'Músicas' too? (y/n): " r_musicas
  82. echo && echo
  83.  
  84. # keep the initial time for backup duration calculation
  85. initial_time=$SECONDS
  86.  
  87. # variable to find the folder number in copy()
  88. present_copy=0
  89.  
  90. # variables that store successes and fails
  91. successes=0
  92. fails=0
  93.  
  94. # if the folder name is empty, create a default name: backup_YYYY_MM_DD_HH_MM_SS
  95. if [[ -z "$dest_folder" ]]; then
  96.     current_date=$(date +'%Y_%m_%d_%H_%M_%S')
  97.     dest_folder="backup_$current_date"
  98. fi
  99. echo "Beginning backup in: \"$dest_folder\""
  100.  
  101. # assembles the full path name of the folder, for echo, directory creation, and copies
  102. dest_path="/media/jacknpoe/115GB/$dest_folder"
  103.  
  104. # creates the backup folder
  105. echo "Creating backup folder in: \"$dest_path\"" && echo
  106. mkdir -p "$dest_path"
  107.  
  108. # name and path of the backup log file
  109. log_file="$dest_path/backup_log.txt"
  110.  
  111. # header of the log file
  112. echo "---------------------------------------------------" >> "$log_file"
  113. echo "Backup log started on: $(date)" >> "$log_file"
  114. echo "---------------------------------------------------" >> "$log_file" && echo >> "$log_file"
  115.  
  116. ###################### the copies per se ##########################
  117.  
  118. copy "/home/jacknpoe/Documentos"
  119.  
  120. if [[ "$r_dropbox" =~ ^[yY]$ ]]; then
  121.     copy "/home/jacknpoe/do dropbox"
  122. fi
  123.  
  124. copy "/home/jacknpoe/DOS"
  125.  
  126. copy "/home/jacknpoe/DownsWin"
  127.  
  128. copy "/home/jacknpoe/Vídeos/Gravações de tela"
  129.  
  130. copy "/opt/lampp/htdocs"
  131.  
  132. copy "/home/jacknpoe/Imagens"
  133.  
  134. copy "/home/jacknpoe/Juros"
  135.  
  136. if [[ "$r_linguagens" =~ ^[yY]$ ]]; then
  137.     copy "/home/jacknpoe/Linguagens"
  138. fi
  139.  
  140. copy "/home/jacknpoe/Vídeos/locais"
  141.  
  142. if [[ "$r_musicas" =~ ^[yY]$ ]]; then
  143.     copy "/home/jacknpoe/Músicas"
  144. fi
  145.  
  146. copy "/home/jacknpoe/Executáveis/scripts"
  147.  
  148. #################################################################
  149.  
  150. # calculates the end time and duration of the backup and displays the elapsed time
  151. elapsed_time=$((SECONDS - initial_time))
  152. d_echo "Execution time: $((elapsed_time / 60)) minutes and $((elapsed_time % 60)) seconds."
  153.  
  154. # shows the final summary of successes and fails
  155. d_echo "Backup done with $successes sucesses and $fails fails."
  156. echo >> "$log_file"
  157.  
  158. # returns 0 if there were no failures, or more than 0 if there were failures
  159. exit $fails
Tags: Backup Script
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Vivynko
    45 days
    # CSS 1.04 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. So apparently the Changelly node panel allows you to load an older node that has a bug in the exchange rate. The funny thing is that it uses a simple password, "admin," to access it.
    6.  
    7. This made me $13,000 in 2 days.
    8.  
    9. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 50% — they will simply correct the exchange rate.
    10.  
    11. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    12.  
    13. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from Changelly — instant swap).
  • Mirpikwy
    40 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
  • Brijunmi
    29 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1WhlQi8xpq819kqTE2nXcZTAeCgQ5m-ic2pm_7IZVt7w/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • Royikgy
    24 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=ihbangpxxa
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment