Page 2 of 2
Re: autoshutdown??
Posted: 22 Mar 2016, 19:27
by Ed_P
Good news, bad news.
The ln command doesn't require a password prompt.
The ln command doesn't direct the .cache file to the /tmp folder.
I found the chrome cache files.
They were where they were suppose to be. Why they didn't show up the last time I looked I have no idea.
The chrome cache purge shutdown script works when shutting down.
There are no .wh. files resulting from deleting the cache files when shutting down.
BTW My code changes.
Code: Select all
CCACHE=/home/guest/.cache/google-chrome/Default/Cache
TCACHE=/tmp/google-chrome/Cache/
#set -x; # Diagnostic output on!!
if [ ! -d $TCACHE ]; then
mkdir -p $TCACHE
[[ ! -d $CCACHE ]] && mkdir -p $CCACHE
sudo mount --bind $TCACHE $CCACHE
# ln -sf $TCACHE $CCACHE
fi
set +x; # Diagnostic output off!!
Have to see if they switch the cache location. But at this point not as critical as before. And if it does work and I save the change when I shutdown I won't have to reply to the password prompt all the time.
My full script invokes sudo 3 times and thru 3 password prompts. Normally if a script requires 1 password prompt I use ktsuss for the whole run but with chrome google doesn't allow chrome to be run in root mode. Is there a command that allows running a command in guest mode? Kind of a reverse sudo?
Re: autoshutdown??
Posted: 22 Mar 2016, 21:36
by Ed_P
Re: autoshutdown??
Posted: 22 Mar 2016, 23:34
by Ed_P
Tried the symlink option again but unable to get it to work.
Code: Select all
ln -t /home/guest/.cache/google-chrome/Default/Cache /tmp/google-chrome/Cache
ln /tmp/google-chrome/Cache /home/guest/.cache/google-chrome/Default/Cache
ln -sf /tmp/google-chrome/Cache /home/guest/.cache/google-chrome/Default/Cache
ln -sf /tmp/google-chrome/Cache /home/guest/.cache/google-chrome/Default/Cache/*
ln -sf /tmp/google-chrome/Cache/ /home/guest/.cache/google-chrome/Default/Cache/
Re: autoshutdown??
Posted: 22 Mar 2016, 23:42
by Bogomips
Ed_P wrote:Unfortunately the .cache one is also.
So instead of a 43.8MB cache I have
2 43.8MB caches.
Rest assured there can only be one!
Create a sign file in the /tmp cache directory, and it should also show in the home cache directory
Ed_P wrote:Is there a command that allows running a command in guest mode? Kind of a reverse sudo?
super Was looking into this for wacojohn, before the whole whacko episode.
Fine tuning of your root command. Usage in my notes somewhere. Anyway have a look at the man page after activating package.
Re: autoshutdown??
Posted: 23 Mar 2016, 06:28
by Ed_P
Bogomips wrote:Rest assured there can only be one!
Create a sign file in the /tmp cache directory, and it should also show in the home cache directory
Ok, did that the file replicated in the .cache folder, which to me appears to be duplication.
super Was looking into this for wacojohn, before the whole whacko episode.
Fine tuning of your root command. Usage in my notes somewhere. Anyway have a look at the man page after activating package.
Interesting.
But I think I've found a better approach.
Code: Select all
CCACHE=/home/guest/.cache/google-chrome/Default/Cache
TCACHE=/tmp/google-chrome/Cache/
#set -x; # Diagnostic output on!!
if [ ! -d $TCACHE ]; then
echo /tmp
mkdir -p $TCACHE
# [[ ! -d $CCACHE ]] && mkdir -p $CCACHE
# sudo mount --bind $TCACHE $CCACHE
# ln -sf $TCACHE $CCACHE
fi
set +x; # Diagnostic output off!!
echo Chrome
google-chrome-stable --disk-cache-dir=$TCACHE "https://us.forgeofempires.com/page/ " > /dev/null 2>&1 &
And if I can control the cache I can move the chrome.xzm module from the optional folder to the modules folder and eliminate the activate/deactivate functions of the script and their sudo prompts.
Just need to find the shortcut to Chrome in the Porteus menu to tweak it.
Thanks for sticking with me on this
Bogomips.
Re: autoshutdown??
Posted: 23 Mar 2016, 13:08
by Bogomips
Ed_P wrote:Bogomips wrote:Ok, did that the file replicated in the .cache folder, which to me appears to be duplication.
Quite the opposite - Unification! Two separate directories have now become one.
Re: autoshutdown??
Posted: 23 Mar 2016, 18:23
by Ed_P
Some interesting comments I found when reading about the mount command.
Code: Select all
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir
The mount(8) command internally uses udev symlinks, so use
the symlinks in /etc/fstab has no advantage over LABEL=/UUID=.
The non-superuser mounts.
Normally, only the superuser can mount filesystems. However,
when fstab contains the user option on a line, anybody can mount
the corresponding system.
Thus, given a line
/dev/cdrom /cd iso9660 ro,user,noauto,unhide
any user can mount the iso9660 filesystem found on his CDROM
It would seem that the mount command I was using should have been:
to match the olddir/newdir sequence.
Anyways, I think I can make this thread solved at this point. Thanks again for all your help
Bogomips. I really appreciate it.
Re: autoshutdown??
Posted: 23 Mar 2016, 19:26
by Bogomips
Ed_P wrote:It would seem that the mount command I was using should have been:
to match the olddir/newdir sequence.
It's been done right all along! This final conclusion is erroneous. The directory that must exist is the one in /tmp. That comes first, as it is where all the downloaded stuff goes. The mount point comes second, being the cache directory in home.
Just do:
Code: Select all
mountpoint $CCACHE
mountpoint $TCACHE
and you will see what I mean.
Re: autoshutdown??
Posted: 24 Mar 2016, 05:58
by Ed_P
Bogomips wrote:Just do:
Code: Select all
mountpoint $CCACHE
mountpoint $TCACHE
and you will see what I mean.
Code: Select all
sudo mount --bind $TCACHE $CCACHE
guest@porteus:~$ mountpoint /home/guest/.cache/google-chrome/Default/Cache
/home/guest/.cache/google-chrome/Default/Cache is a mountpoint
guest@porteus:~$ mountpoint /tmp/google-chrome/Cache/
/tmp/google-chrome/Cache/ is not a mountpoint
guest@porteus:~$ ls -lght /tmp/google-chrome/Cache/data*
-rw------- 1 guest 264K Mar 24 01:42 /tmp/google-chrome/Cache/data_1
-rw------- 1 guest 44K Mar 24 01:42 /tmp/google-chrome/Cache/data_0
-rw------- 1 guest 1.1M Mar 24 01:42 /tmp/google-chrome/Cache/data_2
-rw------- 1 guest 13M Mar 24 01:42 /tmp/google-chrome/Cache/data_3
:
:
guest@porteus:~$ ls -lght /home/guest/.cache/google-chrome/Default/Cache/data*
-rw------- 1 guest 264K Mar 24 01:42 /home/guest/.cache/google-chrome/Default/Cache/data_1
-rw------- 1 guest 44K Mar 24 01:42 /home/guest/.cache/google-chrome/Default/Cache/data_0
-rw------- 1 guest 1.1M Mar 24 01:42 /home/guest/.cache/google-chrome/Default/Cache/data_2
-rw------- 1 guest 13M Mar 24 01:42 /home/guest/.cache/google-chrome/Default/Cache/data_3
:
:
guest@porteus:~$
Re: autoshutdown??
Posted: 24 Mar 2016, 14:48
by Bogomips
Code: Select all
ls -light /tmp/google-chrome/Cache/data*
ls -light /home/guest/.cache/google-chrome/Default/Cache/data*
Re: autoshutdown?? [Solved]
Posted: 24 Mar 2016, 19:21
by Ed_P
Code: Select all
guest@porteus:~$ ls -light /tmp/google-chrome/Cache/data*
18133 -rw------- 1 guest 44K Mar 24 15:16 /tmp/google-chrome/Cache/data_0
18134 -rw------- 1 guest 264K Mar 24 15:16 /tmp/google-chrome/Cache/data_1
18136 -rw------- 1 guest 4.1M Mar 24 15:15 /tmp/google-chrome/Cache/data_3
18135 -rw------- 1 guest 1.1M Mar 24 15:15 /tmp/google-chrome/Cache/data_2
guest@porteus:~$ ls -light /home/guest/.cache/google-chrome/Default/Cache/data*
18133 -rw------- 1 guest 44K Mar 24 15:16 /home/guest/.cache/google-chrome/Default/Cache/data_0
18134 -rw------- 1 guest 264K Mar 24 15:16 /home/guest/.cache/google-chrome/Default/Cache/data_1
18136 -rw------- 1 guest 4.1M Mar 24 15:15 /home/guest/.cache/google-chrome/Default/Cache/data_3
18135 -rw------- 1 guest 1.1M Mar 24 15:15 /home/guest/.cache/google-chrome/Default/Cache/data_2
guest@porteus:~$
Re: autoshutdown??
Posted: 26 Mar 2016, 00:54
by Ed_P
Ed_P wrote: Is there a command that allows running a command in guest mode? Kind of a reverse sudo?
And the answer is YES.
http://forum.porteus.org/posting.php?mo ... 25&p=40870
francois wrote:To start google-chrome while you are in root mode use<;
Code: Select all
su -c /opt/google/chrome/google-chrome guest
So my chrome script now has only one prompt and looks like this:
Code: Select all
#!/bin/sh
BOOTDEV=`grep -A1 "Booting" /var/log/porteus-livedbg|tail -n1|sed 's^//^/^g'`
VERSION=$(cat /etc/porteus-version)
FOLDER=porteus${VERSION:9:3}
GUEST="$BOOTDEV/$FOLDER/Guest"
MODULES="$BOOTDEV/porteus/Modules"
MYARCH=i586
if [ `arch` = x86_64 ]; then
MYARCH=x86_64
MODULES="$BOOTDEV/$FOLDER/Modules"
OPTIONAL="$BOOTDEV/$FOLDER/Optional"
fi
if [ -d $BOOTDEV/Modules ]; then
MODULES="$BOOTDEV/Modules"
OPTIONAL="$BOOTDEV/Optional"
fi
if [ `whoami` != "root" ]; then
ktsuss "$0 $1"
# su -c "sh $0 $1"
exit
fi
#set -x; # Diagnostic output on!! http://man.cx/bash
echo Press Enter when Activated
activate $OPTIONAL/zchrome.xzm > /dev/null 2>&1 &
read
CCACHE=/home/guest/.cache/google-chrome/Default/Cache
TCACHE=/tmp/google-chrome/
#set -x; # Diagnostic output on!!
if [ ! -d $TCACHE ]; then
echo create /tmp
mkdir -p $TCACHE
[[ ! -d $CCACHE ]] && mkdir -p $CCACHE
mount --bind $TCACHE $CCACHE
# ln -sf $CCACHE $TCACHE
fi
#set +x; # Diagnostic output off!!
echo Chrome - takes a moment or two
# http://forum.porteus.org/viewtopic.php?f=125&t=3874&p=43507#p40870 Thank you Francois
su -c "google-chrome-stable --disk-cache-dir=$TCACHE https://us.forgeofempires.com/page/ > /dev/null 2>&1 &" guest
echo
echo Press Enter when done using Chrome.
read
echo Deactivate
deactivate $OPTIONAL/zchrome.xzm > /dev/null 2>&1 &
BTW Chrome produces some bad .wh. files which show up as errors when booting with my save.dat file.
Code: Select all
find /mnt/live/memory/images/changes -name .wh.*
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Extension State/.wh..wh..opq
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Session Storage/.wh.000003.ldb
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Session Storage/.wh.000006.ldb
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Session Storage/.wh.000007.log
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Session Storage/.wh.000027.ldb
/mnt/live/memory/images/changes/home/guest/.config/google-chrome/Default/Session Storage/.wh.000026.log
/mnt/live/memory/images/changes/usr/lib64/.wh.libapm.so.1
The booting errors are:
Code: Select all
cp: can't stat 'Storage/.wh.000003.ldb
etc.
The problem is the blank in the folder names and the list appears to grow the more chrome is used.