last day (15 days later) » 

3:56 PM
@terdon
it gives me the following: stat: *: stat: No such file or directory
when I try Glenn's suggestion
and I have assigned numfolders=7
 
Hi
 
@terdon Thank you!
:)
 
OK, please show me the entire script
@AntonTodorov np :)
 
#!/bin/bash

# Shell script to backup mysql databases.
# Edited by Anton Todorov, <anton.todorov89@gmail.com>.
# Backs up all tables of all databases on a specified host to sql files, (can be gzipped if needed).
# One backup per datestamp, so if you run the script ten times in one day, it will create ten different backups for that day.
# You can also exclude some databases from backup. Version 3.0 - Mar. 18, 2015

# It is not necessary, but you can run it as root! A function to check for root privilegues should probably be added here.
That's all of it.
and I have the old "# Setting a hostname for each destination" section
 
1 message moved from Root Access
3 messages moved from Root Access
Hmm
It looks like it's not accepting the * for some reason.
What is the output of stat -f "%m %N" *? Does that work OK from the commandline?
Could it be that the $NOW directory is not created?
 
4:04 PM
that is a bigger part of the output as I see it:
Last login: Wed May 13 18:56:10 on ttys000
alex:~ admin$ cd Desktop/
alex:Desktop admin$ sh DatabaseBackup-not_ready.sh
stat: *: stat: No such file or directory
Wed May 13 18:56:38 EEST 2015: Starting to work on MySQL Host named SF-Mac-Server
2015.05.13_18h56m38s: + Running in database: Assets
2015.05.13_18h56m38s: - Dumping table: Access_User
no, the $NOW directories are created and all backups are good
I am just trying to delete the older directories
so I do not run out of space
 
@AntonTodorov OK. but $NOW was just created, it will be empty. Why are you running the stat command there?
That's why you get the error, * evaluates to empty so it is passed to stat literally.
That's the error you get when you run stat * on a directory that contains nothing.
 
Good point. I moved it above where it is the DEST folder
 
$ tree
.

0 directories, 0 files
$ stat *
stat: cannot stat ‘*’: No such file or directory
$
 
and it just lists everything
it does not delete them
 
@AntonTodorov You could also use stat "${DEST}"/*, that should work as well.
@AntonTodorov OK, that's a start though. Is the output correct?
 
4:10 PM
Awesome, that was it!
 
Ah, cool. What was? Adding the $DEST/*?
 
@terd
@terdon, You can not imagine what I feel now... :D :D :D I feel like an idiot :D
yeah, as you said I've been looking for older 'stuff' in the $NOW dir.
 
@AntonTodorov I know the feeling :)
 
I placed the row for seeking in the upper/higher dir and it is all working now.
=))
 
Cool. Please accept Glenn's answer since he did actually give the solution.
 
4:11 PM
i knew it's something very small and that's why I did not really want to spam the thread
plus I did not really have time until now.
yup, all of them are solutions actually.
it is my fault that I did not check carefully
shall I add final comment somewhere to say what was the actual reason for all these errors?
hmm... and I can not find how to mark Glenn's comment as answer. Guide me, please.
 
@AntonTodorov There should be a checkmark on the left of the answer.
@AntonTodorov You could add it to your OP, or just accept the answer.
 
4:58 PM
@terdon sorry f or the late answer, I just accepted it, but after a refresh it did not come-up as an answer of the question.
Ah, I just saw the grey checkmark and I clicked on it. Thank you!
It's time now to go on the next level and add a fork to that script.
Thank you again!!! ^_^ Amm may I still stay in that room and ask if I'm missing something?
 
5:15 PM
@AntonTodorov Sure. Either that, or post a new question. For this kind of thing, I suggest you ask on Unix & Linux instead.
I am also always available in the Unix & Linux chat room.
 
5:59 PM
@terdon Thank you very much once again! :)
 

last day (15 days later) »