Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested cron syntax doesn't work #50

Closed
addisonklinke opened this issue Aug 26, 2022 · 4 comments
Closed

Suggested cron syntax doesn't work #50

addisonklinke opened this issue Aug 26, 2022 · 4 comments

Comments

@addisonklinke
Copy link

The crontab entry recommended in the readme has multiple issues

# Wrong install location as of v0.1.5 (should be /snap/bin/autotrash)
root@ubuntu# /usr/bin/autotrash -d 30
-bash: /usr/bin/autotrash: No such file or directory 

# Looks at root's trash instead of a user's
root@ubuntu# autotrash -d 30
Can not find trash information directory. Make sure you have at least GNOME 2.24
I was looking at: /home/root/.local/share/Trash/info

# Still errors even with explicit -T that is confirmed to exist
root@ubuntu# ls /home/addison/.local/share/Trash/info
test.trashinfo
root@ubuntu# autotrash -d 30 -T /home/addison/.local/share/Trash/info
Can not find trash information directory. Make sure you have at least GNOME 2.24
I was looking at: /home/addison/.local/share/Trash/info/info

I would expect the last correction to work, but it still doesn't. Perhaps its a permissions issue?

@addisonklinke
Copy link
Author

Also the --install flag for automatic systemd is no longer supported, so cron is my only option to automate this

@MithicSpirit
Copy link
Contributor

MithicSpirit commented Aug 26, 2022

Wrong install location as of v0.1.5 (should be /snap/bin/autotrash)

Snap isn't even officially supported. Note that the only snap for autotrash is https://snapcraft.io/autotrash-unofficial, which is clearly unofficial.


Looks at root's trash instead of a user's

It checks as the current user, so if you're root (which it seems like you are from your prompt) it'll check as root. There is an issue here though, as root's home is /root rather than /home/root, so that should be fixed.

EDIT: On my system I don't get this issue. Might be an issue with the snap version (it is quite old). Can you try, from a root shell, to echo $XDG_DATA_HOME and echo $HOME?


Still errors even with explicit -T that is confirmed to exist

You're supposed to put the entire trash directory (so /home/addison/.local/share/Trash in your case) rather than specifically the info subdirectory.

EDIT: I don't get an issue with either on my system, so maybe this is also problem with the snap version. Note that autotrash is available both on pip (distro-agnostic) and on Ubuntu bionic.

@MithicSpirit
Copy link
Contributor

I've looked back through all of the git history and cannot find anything that would make it check /home/root instead of just /root, but I did find it in the unofficial snapcraft YAML, so this is definitely an issue with that instead. Additionally, the snap seems to be quite old (says 0.1.5 but since it was released on May 2020 it might be 0.3.0? I'm kind of confused with what's going on there since 0.1.5 was released in 2011), so you should probably update to the latest version (0.4.4) if possible.

The package on Ubuntu bionic also says it's from 0.1.5, so it's probably best to not use it and stick with pip.

I think that the situation with 0.1.5 might be that it's the latest version to support being run on python2? Not sure but that would make sense since the Ubuntu bionic package depends on python>=2.5 and the unofficial snap says that it's made "for programs that disappeared from Ubuntu repositories because they are not compatible with versions of packages/libraries, for example programs made in Python 2."

@addisonklinke
Copy link
Author

You're supposed to put the entire trash directory rather than specifically the info subdirectory

Tried this and still getting the "can not find trash information directory" error

Can you try, from a root shell, to echo $XDG_DATA_HOME and echo $HOME?

  • XDG_DATA_HOME = empty
  • HOME = /root

Note that autotrash is available both on pip (distro-agnostic) and on Ubuntu bionic

Ah good to know! I originally heard about autotrash in a blog post which must've recommended snap so I didn't realize there were other options. I'm on Ubuntu focal, but the pip install worked great. It's v0.4.4 and has all the expected behavior for cron which the unofficial snap was missing (proper interpretation of -T flag and correct default /root/.local/share/Trash/info). Working as expected now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants