I want to execute automated user clean up tasks from the host Bash. Manually, I run
/var/discourse/launcher enter app rails c UserDestroyer.new(Discourse.system_user).destroy(User.find_by_username_or_email("firstname.lastname@example.org"), delete_posts: false)
I have a long list of user names from a text file that need to be removed. Manually executing this is not reasonable. I tried to wrap the deletion command in a bash script. When executing rails c with the
launcher app subcommand, the Redis connection fails:
/var/discourse/launcher run app "echo \"User.find_by_username_or_email('email@example.com')\" | rails c" Failed to report error: Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) 2 Error connecting to Redis on localhost:6379 (Errno::EADDRNOTAVAIL) subscribe failed, reconnecting in 1 second.
However, when I compare the environments with
launcher enter app and
launcher run app, they look pretty much identical. What am I missing?
launcher run starts in
launcher enter directly enters
/var/www/discourse. Using a cd before executing rails does not help.
Any hints? Thanks!