cron weekly to clean up files

In trying to clean up old images, I get this message:

linux-j16l:/home/davek # /etc/cron.weekly/btrfs-balance.sh
bash: /etc/cron.weekly/btrfs-balance.sh: No such file or directory
linux-j16l:/home/davek # 

Should I create a directory?

I ran this first:

linux-j16l:/home/davek # /etc/cron.daily/suse.de-snapper

How do I correct this?
Thanks

  1. A bit sideways, but why are you trying to run things as root (which is correct for this case) while your working directory is the home directory of some end-user? Always chance that you break something for that user or leave there rubbish.

  2. When the message says that the file you try to execute does not exist, it most probably means that that file does not exist. So the questions is did you make a typo, or did you read something that told you that that file should exist (which is apparently not true). or …

I am the end user. Don’t know what you mean by that? I’m running comands that were given to me in the forum.
https://forums.opensuse.org/showthread.php/521636-How-to-run-cron-jobs

On Thu 06 Apr 2017 11:26:01 AM CDT, vinoman2 wrote:

hcvv;2818930 Wrote:
> 1) A bit sideways, but why are you trying to run things as root (which
> is correct for this case) while your working directory is the home
> directory of some end-user? Always chance that you break something for
> that user or leave there rubbish.
>
> 2) When the message says that the file you try to execute does not
> exist, it most probably means that that file does not exist. So the
> questions is did you make a typo, or did you read something that told
> you that that file should exist (which is apparently not true). or
> …

I am the end user. Don’t know what you mean by that? I’m running comands
that were given to me in the forum.
http://tinyurl.com/mwdt6mj

Hi
You need to ensure the package called btrfsmaintenance is installed
for the other cronjob.


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.38-50-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

When you are the end-user, you can not do what you want to do. You must be the superuser (root).

But I assume that you are root (because the prompt ends in a #). Isn’t that true?

I started reading that other thread. But in post #2 there it says:

In Tumbleweed it’s just btrfs-balance.

I have no idea why you added the .sh in your first post there. And I have of course also no idea why you did not see the correction offered to you in post #2 and above make the same typing error again.

In any case, looking in /etc/cron.weekly/ would probably have shown you that while btrfs-balance.sh isn’t there, btrfs-balance is. Thus giving you a valuable hint. :wink:

Thank you. the .sh was a typo from the person who sent it. Now the command is running fine. :slight_smile:

Maybe other ones typo, but it was corrected in your other thread.

And again, next time try to interprete the error message and check if what you try to start is there and see if maybe something else is there that could be a solution. In other words, try to learn from it. :wink:

And, of course, nice it works now.

OK, after updates I ran the two commands for cleaning up the files and this time the btrfs-balance file was gone, so it couldn’t find file, I created a new brtfs-balance folder/directory and this time I get this:

linux-j16l:/home/davek # /etc/cron.weekly/btrfs-balance
bash: /etc/cron.weekly/btrfs-balance: No such file or directory
linux-j16l:/home/davek # /etc/cron.weekly/btrfs-balance
bash: /etc/cron.weekly/btrfs-balance: Is a directory
linux-j16l:/home/davek # 


It recognized the directory but it didn’t run the cron.weekly. Why ?

Isn’t it about time to show us (and yourself) what is there (and thus what is not there)?

And of coures, the first thing you should do when you get such an error message is checking for yourself if the computer is correct (well, it mostly is):

ls -l /etc/cron.weekly/btrfs-balance

OOr check what is in the directory:

ls -l /etc/cron.weekly/

And this advice is not very different from my last few lines in post # 5 above.

In fact I do not understand at all what you are doing. You say you created a directory and then you make a command as if that directory was an executable file?
You do that two times and you get a different error on those two.
Can we really trust what you show us there?

I was told to run this command to clean out files that build up from every update.

linux-j16l:/home/davek # /etc/cron.weekly/btrfs-balance

I’m just following what I was told to do. I didn’t do anything different. Sorry that you can’t help me. I guess the cron weekly command doesn’t work every time. :frowning:

FWIW,
I don’t know what you might mean by “clean up” files, but btrfs-balance does not do much more than change the layout of the disk blocks used for your images… That should improve performance and <maybe> result in some compaction, but otherwise if you’re looking for some significant disk space recovery, it won’t compare to actually removing unwanted images.

https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-balance

TSU

That’s all I want I want to do is clean up images from all the updates that fill up the hdd. What is the best way to remove old images that are no longer needed?

Thank you

Complete instructions here

https://en.opensuse.org/Portal:Snapper

Thank you. I will read up on it and use its functions.

I’m actually having a similar problem, although I called btrfs-balance for different reasons. It turns out it was the only command in my cron.weekly folder, which is now empty.

linux-syw2:/etc/cron.weekly # ls
linux-syw2:/etc/cron.weekly # 

as is cron.monthly.

Is it possible to recreate btrfs-balance? (I’m not ready to part ways with it yet, haha)
Thank you in advance!

Hi
Just search for it :wink:


zypper se --file-list btrfs-balance

Then use zypper in -f <packages> to force re-install…

Thank you! That solved it!