LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2017, 02:24 AM   #1
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Rep: Reputation: Disabled
Automate removal of rogue directories generated by Nvidia Shield TV (Android) on Linux shares.


Hi there,

My name is Alex, and this is my first post. I'm going to try to keep this short. Android is incredibly difficult to control, and I'm sure someone out there knows what I'm talking about when I say it spreads it's seed (Android directories) to everything it touches.

I'm using LibreELEC 8.0.1, and I can easily access the CLI via SSH from my Mac's Terminal. LibreELEC and Kodi forum posts keep racking up views, but either nobody cares to answer, or nobody in those communities knows.

Both B and C are currently active, with no improvement. These are commands I found online - I'm a noob with enough
logic to be able to deconstruct a command and its parameters at least somewhat.

What should I be doing?
A) Somehow making Android stop generating these directories? (Customization on Android TVs seems nearly impossible.)
B) edit samba.conf, add the lines below to each preconfigured share
veto files = /Android/
delete veto files = yes
C) cron job - command works manually, but not via cron daemon (see screenshot)

https://image.ibb.co/d2MWgQ/Screen_S...2_53_43_AM.png
 
Old 04-12-2017, 08:59 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
root seems to have a cron.
you stuck this find command into it? or a script (something you ALLOWED)?
 
Old 04-12-2017, 09:20 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,258

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
maybe use full paths.
Code:
/usr/bin/find
/usr/bin/xargs
?
 
Old 04-12-2017, 03:23 PM   #4
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
root seems to have a cron.
you stuck this find command into it? or a script (something you ALLOWED)?
Thanks for your reply, Habitual.

I'm not sure - other than this, I'm running LibreELEC with mostly default settings.

In the LibreELEC settings (simply an additional GUI menu amongst the standard Kodi menus, there is an option for cron to be turned on or off. Of course I have it turned on.)

At the command line, I
Code:
crontab -e
and the resulting document was blank. I typed in the command you see in the screenshot, which I had already verified worked at the command line (which is also demonstrated in the screenshot), saved the crontab file, and from the looks of it, it's running the manually validated command every 10 minutes, yet these directories are still present, even when the Android device is off.

Also when I manually run the command, I can see the an Android folder disappear in Finder on my Mac. But I never see it disappear if I leave a Finder window open and wait on the cron job.

Again, this is all new to me; if there's something else to know about the cron function that I'm missing, please let me know.

When you say root seems to have a cron - does that mean I should be doing this elsewhere? I typed cd / before crontab -e. Should I be at a user prompt?
 
Old 04-12-2017, 03:24 PM   #5
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
maybe use full paths.
Code:
/usr/bin/find
/usr/bin/xargs
?
Thanks for your reply!

I've gotta run, but I'll try that when I get home in a few hours and report back.
 
Old 04-16-2017, 10:27 PM   #6
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by schneidz View Post
maybe use full paths.
Code:
/usr/bin/find
/usr/bin/xargs
?
I figured it out. I added cd / before and cd ~ after the find & xargs commands, and since it was properly running from root that way, it solved the problem!

Code:
*/10 * * * * cd /;find . -maxdepth 5 -type d -name "Android" -print0 | xargs -0 rm -rf;cd ~
Does that make sense? I'm not finding any more Android folders, so I think I'm doing it right.
 
Old 04-17-2017, 10:57 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,456
Blog Entries: 9

Rep: Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370Reputation: 3370
;cd ~
what purpose does that serve?
and instead of
cd /;find .
you could also use
find /

are you sure it works without giving the full path, i.e. /bin/find or /usr/bin/find?
 
1 members found this post helpful.
Old 04-17-2017, 11:55 AM   #8
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Glad it worked out.
 
Old 04-17-2017, 03:08 PM   #9
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
;cd ~
what purpose does that serve?
and instead of
cd /;find .
you could also use
find /

are you sure it works without giving the full path, i.e. /bin/find or /usr/bin/find?
It probably serves no purpose, based on your question. With very little experience in Linux, I took the "put things back the way they were" approach.

It definitely works, because the Nvidia Shield TV generated those Android folders constantly, and they are nowhere to be seen now.

Thanks for the info; more info on command structure is always be useful.

Quote:
Originally Posted by Habitual View Post
Glad it worked out.
Thank you!
 
Old 04-17-2017, 03:09 PM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by alex_sisk View Post
I took the "put things back the way they were" approach.
I knew I liked you.
 
Old 04-17-2017, 03:17 PM   #11
alex_sisk
LQ Newbie
 
Registered: Apr 2017
Location: Orlando, FL
Distribution: Ubuntu 18.04
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
I knew I liked you.
LOL. Hey, it's a good habit whether in day to day life or behind the keyboard. (And especially I suppose when those two scenarios are one and the same.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Nvidia Shield Android TV review: Linux conquers the living room LXer Syndicated Linux News 0 01-07-2016 11:27 PM
LXer: Latest Nvidia Shield player runs Android TV on Tegra X1 LXer Syndicated Linux News 0 03-05-2015 01:40 AM
LXer: Nvidia Shield embraces Android games by the thousands LXer Syndicated Linux News 0 10-28-2013 10:12 PM
Google removes rogue Android apps Jeebizz Linux - News 1 03-07-2011 08:50 PM
Android hit by rogue app viruses Jeebizz Linux - News 2 03-04-2011 04:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration