tmpwatch problem

View: New views
16 Messages — Rating Filter:   Alert me  

Re: tmpwatch problem

by Thomas Backlund :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Wilson skrev:
> For some reason I can't get tmpwatch to run on this laptop - it used to.
>
> usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp


Is this a typo, or did you forget the initial /

> bash: usr/sbin/tmpwatch: No such file or directory
> [anne@anne-laptop ~]$ locate tmpwatch
> /etc/cron.daily/tmpwatch
> /etc/sysconfig/tmpwatch
> /usr/sbin/tmpwatch
>
> ~/.tmp certainly does exist as well.  It's funny, this command has always
> worked for me.
>
> Anne


tmpwatch problem

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For some reason I can't get tmpwatch to run on this laptop - it used to.

usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp
bash: usr/sbin/tmpwatch: No such file or directory
[anne@anne-laptop ~]$ locate tmpwatch
/etc/cron.daily/tmpwatch
/etc/sysconfig/tmpwatch
/usr/sbin/tmpwatch

~/.tmp certainly does exist as well.  It's funny, this command has always
worked for me.

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: tmpwatch problem

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 17 June 2009 12:43:00 Thomas Backlund wrote:
> Anne Wilson skrev:
> > For some reason I can't get tmpwatch to run on this laptop - it used to.
> >
> > usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp
>
> Is this a typo, or did you forget the initial /
>
Hmm - you know how you see what you expect to see?  Sorry for the wasted
bandwidth.  I should have spotted that.  It does run now and has cleaned up
quite a large number of files.  Thanks

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: tmpwatch problem

by Dick Gevers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 17 Jun 2009 12:58:42 +0100, Anne Wilson wrote about Re: [Expert]
tmpwatch problem:

>On Wednesday 17 June 2009 12:43:00 Thomas Backlund wrote:
>> Anne Wilson skrev:
>> > For some reason I can't get tmpwatch to run on this laptop - it used
>> > to.
>> >
>> > usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp
>>
>> Is this a typo, or did you forget the initial /
>>
>Hmm - you know how you see what you expect to see?  Sorry for the wasted
>bandwidth.  I should have spotted that.  It does run now and has cleaned
>up quite a large number of files.  Thanks

If you'd set an alias in ~/.bashrc, you'd hardly be able to mistype it,
even if it's gone from history.

For example:

alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'

Ciao,
=Dick Gevers=


Aliasing (was Re: tmpwatch problem)

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 17 June 2009 20:03:34 Dick Gevers wrote:

> On Wed, 17 Jun 2009 12:58:42 +0100, Anne Wilson wrote about Re: [Expert]
>
> tmpwatch problem:
> >On Wednesday 17 June 2009 12:43:00 Thomas Backlund wrote:
> >> Anne Wilson skrev:
> >> > For some reason I can't get tmpwatch to run on this laptop - it used
> >> > to.
> >> >
> >> > usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp
> >>
> >> Is this a typo, or did you forget the initial /
> >
> >Hmm - you know how you see what you expect to see?  Sorry for the wasted
> >bandwidth.  I should have spotted that.  It does run now and has cleaned
> >up quite a large number of files.  Thanks
>
> If you'd set an alias in ~/.bashrc, you'd hardly be able to mistype it,
> even if it's gone from history.
>
> For example:
>
> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
>
Can that be done to add parameters?  I mean, for instance, on the F10 netbook,
I would like to alias 'yum update' to 'yum update --skip-broken'.

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by Dick Gevers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing (was
Re: [Expert] tmpwatch problem):

>> For example:
>>
>> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
>>
>Can that be done to add parameters?  I mean, for instance, on the F10
>netbook, I would like to alias 'yum update' to 'yum update --skip-broken'.

Sure: e.g. alias yus='yum update --skip-broken'.

Obviously, if you run it with sudo you'd have to include 'sudo' in front,
and if run as root, you could either put your alias as before in ~/.bashrc
(which is then same as /root/.bashrc), or in any file in /etc/profile.d .
My root aliases are in /etc/profile.d/z_<boxname>.sh


Cheers,
=Dick Gevers=

Re: Aliasing (was Re: tmpwatch problem)

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:

> On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing (was
>
> Re: [Expert] tmpwatch problem):
> >> For example:
> >>
> >> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
> >
> >Can that be done to add parameters?  I mean, for instance, on the F10
> >netbook, I would like to alias 'yum update' to 'yum update --skip-broken'.
>
> Sure: e.g. alias yus='yum update --skip-broken'.
>
> Obviously, if you run it with sudo you'd have to include 'sudo' in front,
> and if run as root, you could either put your alias as before in ~/.bashrc
> (which is then same as /root/.bashrc), or in any file in /etc/profile.d .
> My root aliases are in /etc/profile.d/z_<boxname>.sh
>
Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether it
needs it, but I ran newaliases anyway.  Then I tried 'yus' but got 'command
not found'.  What have I missed?

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by David Guntner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Wilson wrote:

> On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
>> On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing (was
>> Re: [Expert] tmpwatch problem):
>>>> For example:
>>>>
>>>> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
>>>
>>> Can that be done to add parameters?  I mean, for instance, on the F10
>>> netbook, I would like to alias 'yum update' to 'yum update --skip-broken'.
>>
>> Sure: e.g. alias yus='yum update --skip-broken'.
>>
>> Obviously, if you run it with sudo you'd have to include 'sudo' in front,
>> and if run as root, you could either put your alias as before in ~/.bashrc
>> (which is then same as /root/.bashrc), or in any file in /etc/profile.d .
>> My root aliases are in /etc/profile.d/z_<boxname>.sh
>
> Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether it
> needs it, but I ran newaliases anyway.  Then I tried 'yus' but got 'command
> not found'.  What have I missed?
The newaliases command builds the aliases db hash table for
sendmail/postfix. :-)

Your .bashrc file is only executed when a new shell is opened.  Close
the shell you're in after having put the alias command into it and open
a new shell window.  Or you can just type ". ~/.bashrc" to run it from
within the shell window in question (without the quotes, of course) so
you don't have to bring up a new shell.  Either way, your alias should
then be active.

                 --Dave



signature.asc (268 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 19 June 2009 10:21:31 David Guntner wrote:

> Anne Wilson wrote:
> > On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
> >> On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing
> >> (was
> >>
> >> Re: [Expert] tmpwatch problem):
> >>>> For example:
> >>>>
> >>>> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
> >>>
> >>> Can that be done to add parameters?  I mean, for instance, on the F10
> >>> netbook, I would like to alias 'yum update' to 'yum update
> >>> --skip-broken'.
> >>
> >> Sure: e.g. alias yus='yum update --skip-broken'.
> >>
> >> Obviously, if you run it with sudo you'd have to include 'sudo' in
> >> front, and if run as root, you could either put your alias as before in
> >> ~/.bashrc (which is then same as /root/.bashrc), or in any file in
> >> /etc/profile.d . My root aliases are in /etc/profile.d/z_<boxname>.sh
> >
> > Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether
> > it needs it, but I ran newaliases anyway.  Then I tried 'yus' but got
> > 'command not found'.  What have I missed?
>
> The newaliases command builds the aliases db hash table for
> sendmail/postfix. :-)
>
> Your .bashrc file is only executed when a new shell is opened.  Close
> the shell you're in after having put the alias command into it and open
> a new shell window.  Or you can just type ". ~/.bashrc" to run it from
> within the shell window in question (without the quotes, of course) so
> you don't have to bring up a new shell.  Either way, your alias should
> then be active.
>
Didn't think of that.  However, it's still not right.  From a user shell it
says I have to be root (as expected) and from a root shell it says 'command
not found'.  I'll have to try some of the alternatives Dick mentioned

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by Thomas Backlund :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Wilson skrev:

> On Friday 19 June 2009 10:21:31 David Guntner wrote:
>> Anne Wilson wrote:
>>> On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
>>>> On Thu, 18 Jun 2009 09:28:11 +0100, Anne Wilson wrote about Aliasing
>>>> (was
>>>>
>>>> Re: [Expert] tmpwatch problem):
>>>>>> For example:
>>>>>>
>>>>>> alias broom='/usr/sbin/tmpwatch --mtime --verbose 168 /home/anne/.tmp'
>>>>> Can that be done to add parameters?  I mean, for instance, on the F10
>>>>> netbook, I would like to alias 'yum update' to 'yum update
>>>>> --skip-broken'.
>>>> Sure: e.g. alias yus='yum update --skip-broken'.
>>>>
>>>> Obviously, if you run it with sudo you'd have to include 'sudo' in
>>>> front, and if run as root, you could either put your alias as before in
>>>> ~/.bashrc (which is then same as /root/.bashrc), or in any file in
>>>> /etc/profile.d . My root aliases are in /etc/profile.d/z_<boxname>.sh
>>> Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether
>>> it needs it, but I ran newaliases anyway.  Then I tried 'yus' but got
>>> 'command not found'.  What have I missed?
>> The newaliases command builds the aliases db hash table for
>> sendmail/postfix. :-)
>>
>> Your .bashrc file is only executed when a new shell is opened.  Close
>> the shell you're in after having put the alias command into it and open
>> a new shell window.  Or you can just type ". ~/.bashrc" to run it from
>> within the shell window in question (without the quotes, of course) so
>> you don't have to bring up a new shell.  Either way, your alias should
>> then be active.
>>
> Didn't think of that.  However, it's still not right.  From a user shell it
> says I have to be root (as expected) and from a root shell it says 'command
> not found'.  I'll have to try some of the alternatives Dick mentioned
>
> Anne

If you need the alias for root user, then you have yo put it in
/root/.bashrc

Then logout root and login again and it should work.
--
Thomas

Re: Aliasing (was Re: tmpwatch problem)

by David Guntner-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Backlund wrote:

> Anne Wilson skrev:
>> On Friday 19 June 2009 10:21:31 David Guntner wrote:
>>> Anne Wilson wrote:
>>>> On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
>>>>>
>>>>> Obviously, if you run it with sudo you'd have to include 'sudo' in
>>>>> front, and if run as root, you could either put your alias as
>>>>> before in
>>>>> ~/.bashrc (which is then same as /root/.bashrc), or in any file in
>>>>> /etc/profile.d . My root aliases are in /etc/profile.d/z_<boxname>.sh
>>>>
>>>> Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know whether
>>>> it needs it, but I ran newaliases anyway.  Then I tried 'yus' but got
>>>> 'command not found'.  What have I missed?
>>>
>>> The newaliases command builds the aliases db hash table for
>>> sendmail/postfix. :-)
>>>
>>> Your .bashrc file is only executed when a new shell is opened.  Close
>>> the shell you're in after having put the alias command into it and open
>>> a new shell window.  Or you can just type ". ~/.bashrc" to run it from
>>> within the shell window in question (without the quotes, of course) so
>>> you don't have to bring up a new shell.  Either way, your alias should
>>> then be active.
>>
>> Didn't think of that.  However, it's still not right.  From a user
>> shell it says I have to be root (as expected) and from a root shell it
>> says 'command not found'.  I'll have to try some of the alternatives
>> Dick mentioned
>
> If you need the alias for root user, then you have yo put it in
> /root/.bashrc
>
> Then logout root and login again and it should work.
What Thomas said. :-)

However, if you want to use it from your user login, just change the
alias thus:

alias yus="sudo /usr/sbin/yum update --skip-broken"

I'm guessing on /usr/sbin as being the location yum - if I guessed
wrong, then put the correct path in.  Make sure you've added your user
to the /etc/sudoers file so that you're allowed to use it.  Or if you'd
rather not mess with that, you can always make the alias:

alias yus="su -c /usr/sbin/yum update --skip-broken"

             --Dave



signature.asc (266 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by Jim Beard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anne Wilson wrote:
> Didn't think of that.  However, it's still not right.  From a user shell it
> says I have to be root (as expected) and from a root shell it says 'command
> not found'.  I'll have to try some of the alternatives Dick mentioned

What is your $PATH as root?  Bear in mind that you may have to
use ./command for a command in your working directory -- a little
security feature intended to keep root from running something
lying around in the wrong place that might do evil things.

For an alias to be run by root, set it to a full path name.
Also, is the alias set for root as well as for the user?

Cheers!

jim b.

--
UNIX is not user unfriendly; it merely
      expects users to be computer-friendly.

Re: Aliasing (was Re: tmpwatch problem) - SOLVED

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 19 June 2009 18:54:06 David Guntner wrote:

> Thomas Backlund wrote:
> > Anne Wilson skrev:
> >> On Friday 19 June 2009 10:21:31 David Guntner wrote:
> >>> Anne Wilson wrote:
> >>>> On Thursday 18 June 2009 22:35:37 Dick Gevers wrote:
> >>>>> Obviously, if you run it with sudo you'd have to include 'sudo' in
> >>>>> front, and if run as root, you could either put your alias as
> >>>>> before in
> >>>>> ~/.bashrc (which is then same as /root/.bashrc), or in any file in
> >>>>> /etc/profile.d . My root aliases are in /etc/profile.d/z_<boxname>.sh
> >>>>
> >>>> Thanks.  I'm trying this - putting it in ~/.bashrc.  Don't know
> >>>> whether it needs it, but I ran newaliases anyway.  Then I tried 'yus'
> >>>> but got 'command not found'.  What have I missed?
> >>>
> >>> The newaliases command builds the aliases db hash table for
> >>> sendmail/postfix. :-)
> >>>
> >>> Your .bashrc file is only executed when a new shell is opened.  Close
> >>> the shell you're in after having put the alias command into it and open
> >>> a new shell window.  Or you can just type ". ~/.bashrc" to run it from
> >>> within the shell window in question (without the quotes, of course) so
> >>> you don't have to bring up a new shell.  Either way, your alias should
> >>> then be active.
> >>
> >> Didn't think of that.  However, it's still not right.  From a user
> >> shell it says I have to be root (as expected) and from a root shell it
> >> says 'command not found'.  I'll have to try some of the alternatives
> >> Dick mentioned
> >
> > If you need the alias for root user, then you have yo put it in
> > /root/.bashrc
> >
> > Then logout root and login again and it should work.
>
> What Thomas said. :-)
>
> However, if you want to use it from your user login, just change the
> alias thus:
>
> alias yus="sudo /usr/sbin/yum update --skip-broken"
>
> I'm guessing on /usr/sbin as being the location yum - if I guessed
> wrong, then put the correct path in.  Make sure you've added your user
> to the /etc/sudoers file so that you're allowed to use it.  Or if you'd
> rather not mess with that, you can always make the alias:
>
> alias yus="su -c /usr/sbin/yum update --skip-broken"
>
I really should have read the /bashrc file, instead of doing what I expected
it to need :-(  I put the new alias at the end of the file, assuming that
user-added commands belong there.  I simply didn't see that the three already
listed were in the section labelled 'user commands'.  Once I moved the new
alias to that section it does work as expected.

Thanks to all for pointing me in the right direction.  Circular thinking is a
big PITA :-)

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem) - SOLVED

by Chris-394 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 2009-06-20 at 13:09 +0100, Anne Wilson wrote:

>
> Thanks to all for pointing me in the right direction.  Circular thinking is a
> big PITA :-)
>
> Anne

I've a follow-on question to Anne's. tmpwatch works fine here however, I
notice that I still have folders such as these:

drwx------ 2 chris chris  4096 2009-02-06 19:44 seahorse-04U6DC/
drwx------ 2 chris chris  4096 2009-02-08 08:50 seahorse-0k5Ic3/

which contain a socket file:

srw------- 1 chris chris 0 2009-02-06 19:44 S.gpg-agent=

or should I be using the --all option to have these removed also?


--
KeyID 0xE372A7DA98E6705C



signature.asc (204 bytes) Download Attachment

Re: Aliasing (was Re: tmpwatch problem)

by Norman Carver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 19 June 2009 04:05:44 am Anne Wilson wrote:
> Thanks.  I'm trying this - putting it in ~/.bashrc.

Many users have a whole raft of aliases (and functions),
so they keep them in a separate file instead of putting
them directly in the .bashrc file.  For example, I have a
file ~/.aliases where I keep mine.  I have well over 100
aliases and functions in there.  Then I just add the following
line to the end of ~/.bashrc:
  source ~/.aliases

Aliases are useful for three main purposes:
(1) Making standard commands always use certain options:
e.g., alias rm="rm -i"

(2) Making shorthand names for certain commands and options/arguments:
e.g., alias ll="ls -l"  or  alias papers="cd ~/Documents/papers"

(3) Giving more easily remembered names to commands:
e.g., alias dir="ls"  or  alias size="du -hs"

Note that if you just do "alias ls" you will see what the alias is
for ls (if there is one), and if you just do "alias" you will see all
your current aliases.

The one limitation of aliases in Bash is that they are simple
text subsitution, so you cannot embed arguments inside
of your alias (using $1, etc.) as you can for csh aliases.
In Bash, you must use functions for this.  Here are a couple
of the functions that I have in my .aliases file:

function dos2unix {tr -d "\r" < $1 > $2}

or with error checking:
function dos2unix
  { if [[ $# == 2 ]]
      then tr -d "\r" < $1 > $2
      else echo "Usage: dos2unix DOS-FILENAME UNIX-FILENAME"
    fi
  }

#Create new dir and cd to it:
function newdir () { mkdir $1; cd $1 }

Aliases and functions are key methods for improving the
command line experience in Linux/UNIX.
Norm

Re: Aliasing (was Re: tmpwatch problem)

by Bugzilla from cannewilson@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 20 June 2009 17:47:04 Norman Carver wrote:
> Aliases and functions are key methods for improving the
> command line experience in Linux/UNIX.

Filed for future use, thanks :-)

Anne
--
New to KDE4? - get help from http://userbase.kde.org
Just found a cool new feature?  Add it to UserBase


signature.asc (204 bytes) Download Attachment