Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what is the purpose of this command?
#1

Hi to all,

 

i just want to know what is the purpose of this command?

 


  • cd / && run-parts --report /etc/cron.hourly

  • test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

  • test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

  • test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )


 

is this command doing bad in my system?

Reply
#2

looks to me like it's preparing reports on dayly/weekly/monthly basis using cron jobs

 

nothing to worry about i would say... why do you ask ?

Reply
#3

Each of the /etc/cron* directories are used for scheduled jobs - daily, weekly, monthly etc.

 

The "run-parts" script drops into each of those directories and executes all scripts it finds, such as logwatch, logrotate, tripwire, etc.

 

It looks like your system is running anacron (the "-x" bit is testing for its existence) and then running it in "report" mode.

 

Check your emails on that machine - you may find some reports of successful/failed scheduled jobs.

 

Generally, it's nothing to worry about, but it's still worthwhile sneaking a peek in those dirs and familiarising yourself with the scheduled jobs that run. Some could be disabled if they're not needed (recataloguing man pages, for instance)

Reply
#4

Im having problem here my syslog says:

 

Oct 25 23:59:01 samba /USR/SBIN/CRON[8982]: (root) CMD (/opt/sophos-av/bin/savupdate)


Oct 26 00:00:01 samba /USR/SBIN/CRON[9049]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)


Oct 26 00:00:01 samba /USR/SBIN/CRON[9050]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)


Oct 26 00:00:01 samba /USR/SBIN/CRON[9052]: (root) CMD (/root/backup.sh)


Oct 26 00:00:30 samba kernel: SMB connection re-established (-5)


Oct 26 00:04:01 samba /USR/SBIN/CRON[9081]: (root) CMD (/opt/sophos-av/bin/savupdate)


Oct 26 00:05:01 samba /USR/SBIN/CRON[9147]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)


Oct 26 00:05:01 samba /USR/SBIN/CRON[9150]: (root) CMD ([ -x /usr/lib/sysstat/sa1 ] && { [ -r "$DEFAULT" ] && . "$DEFAULT" ; [ "$ENABLED" = "true" ] && exec /usr/lib/sysstat/sa1 $SA1_OPTIONS 1 1 ; })


Oct 26 00:05:01 samba /USR/SBIN/CRON[9151]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)


Oct 26 00:09:01 samba /USR/SBIN/CRON[9180]: (root) CMD (/opt/sophos-av/bin/savupdate)


Oct 26 00:10:01 samba /USR/SBIN/CRON[10270]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)


Oct 26 00:10:01 samba /USR/SBIN/CRON[10272]: (root) CMD (/usr/share/vzctl/scripts/vpsnetclean)


Oct 26 00:14:01 samba /USR/SBIN/CRON[10297]: (root) CMD (/opt/sophos-av/bin/savupdate)


Oct 26 00:15:01 samba /USR/SBIN/CRON[10367]: (root) CMD (/usr/share/vzctl/scripts/vpsreboot)


Oct 26 00:15:01 samba /USR/SBIN/CRON[10371]: (root) CMD ([ -x /usr/lib/sysstat/sa1 ] && { [ -r "$DEFAULT" ] && . "$DEFAULT" ; [ "$ENABLED" = "true" ] && exec /usr/lib/sysstat/sa1 $SA1_OPTIONS 1 1 ; })


 

and my sysstat report me this:

 

03:45:01 AM kbmemfree kbmemused %memused kbbuffers kbcached kbswpfree kbswpused %swpused kbswpcad


03:55:01 AM 44260 4097292 98.93 102384 3702512 2650536 80 0.00 0


04:05:01 AM 43352 4098200 98.95 103288 3702496 2650536 80 0.00 0


04:15:01 AM 43556 4097996 98.95 104228 3701520 2650536 80 0.00 0


04:25:01 AM 43412 4098140 98.95 105284 3700464 2650536 80 0.00 0


04:35:01 AM 43472 4098080 98.95 106240 3699444 2650536 80 0.00 0


04:45:01 AM 44192 4097360 98.93 107176 3698448 2650536 80 0.00 0


04:55:01 AM 43756 4097796 98.94 108000 3697444 2650536 80 0.00 0


05:05:01 AM 43424 4098128 98.95 108876 3696468 2650536 80 0.00 0


05:15:01 AM 44128 4097424 98.93 109840 3695468 2650536 80 0.00 0


05:25:01 AM 44404 4097148 98.93 110852 3694216 2650536 80 0.00 0


05:35:01 AM 44016 4097536 98.94 111816 3693180 2650536 80 0.00 0


05:45:01 AM 44068 4097484 98.94 112756 3692208 2650536 80 0.00 0


05:55:01 AM 43168 4098384 98.96 113708 3692180 2650536 80 0.00 0


06:05:01 AM 43960 4097592 98.94 114684 3690152 2650536 80 0.00 0


06:15:01 AM 43904 4097648 98.94 115500 3689184 2650536 80 0.00 0


06:25:01 AM 42968 4098584 98.96 116524 3689084 2650536 80 0.00 0


06:35:01 AM 3637012 504540 12.18 174532 68044 2650536 80 0.00 0


06:45:01 AM 3628268 513284 12.39 178072 68084 2650536 80 0.00 0


06:55:01 AM 3620156 521396 12.59 182192 69348 2650536 80 0.00 0


07:05:01 AM 3613276 528276 12.76 185360 69328 2650536 80 0.00 0


07:15:01 AM 3604744 536808 12.96 190240 69352 2650536 80 0.00 0


07:25:01 AM 3597612 543940 13.13 194116 69372 2650536 80 0.00 0


07:35:01 AM 3589568 551984 13.33 198652 69388 2650536 80 0.00 0


 

why my memory utilization goes up when it reach 6:35am last Oct 26 ?

 

i only have a cron sched, it looks like this:

 

# /etc/crontab: system-wide crontab


# Unlike any other crontab you don't have to run the `crontab'


# command to install the new version when you edit this file


# and files in /etc/cron.d. These files also have username fields,


# that none of the other crontabs do.


 


SHELL=/bin/sh


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


 


# m h dom mon dow user command


17 * * * * root cd / && run-parts --report /etc/cron.hourly


25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )


47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )


52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )


#


Reply
#5

I can't understand what is this script for?

I got this script in one of the script that resided in /etc/cron.daily

 

#!/bin/sh

#

 

#set -e

#

# This file understands the following apt configuration variables:

#

# "APT::Periodic::Update-Package-Lists=1"

# - Do "apt-get update" automatically every n-days (0=disable)

#

# "APT::Periodic::Download-Upgradeable-Packages=0",

# - Do "apt-get upgrade --download-only" every n-days (0=disable)

#

# "APT::Periodic::AutocleanInterval"

# - Do "apt-get autoclean" every n-days (0=disable)

#

# "APT::Archives::MaxAge",

# - Set maximum allowed age of a cache package file. If a cache

# package file is older it is deleted (0=disable)

#

# "APT::Archives::MaxSize",

# - Set maximum size of the cache in MB (0=disable). If the cache

# is bigger, cached package files are deleted until the size

# requirement is met (the biggest packages will be deleted

# first).

#

# "APT::Archives::MinAge"

# - Set minimum age of a package file. If a file is younger it

# will not be deleted (0=disable). Usefull to prevent races

# and to keep backups of the packages for emergency.

#

 

check_stamp()

{

stamp="$1"

interval="$2"

 

if [ $interval -eq 0 ]; then

return 1

fi

 

if [ ! -f $stamp ]; then

return 0

fi

 

# compare midnight today to midnight the day the stamp was updated

stamp=$(date --date=$(date -r $stamp --iso-8601) +%s)

now=$(date --date=$(date --iso-8601) +%s)

delta=$(($now-$stamp))

 

# intervall is in days,

interval=$(($interval*60*60*24))

#echo "stampfile: $1"

#echo "interval=$interval, now=$now, stamp=$stamp, delta=$delta"

 

if [ $delta -ge $interval ]; then

return 0

fi

 

return 1

}

 

update_stamp()

{

stamp="$1"

 

touch $stamp

}

 

 

 

# we check here if autoclean was enough sizewise

check_size_constraints()

{

# min-age in days

MaxAge=0

MinAge=2

MaxSize=0

CacheDir="var/cache/apt"

CacheArchive="archives/"

eval $(apt-config shell MaxAge APT::Archives::MaxAge)

eval $(apt-config shell MinAge APT::Archives::MinAge)

eval $(apt-config shell MaxSize APT::Archives::MaxSize)

eval $(apt-config shell Dir Dir)

eval $(apt-config shell CacheDir Dir::Cache)

eval $(apt-config shell CacheArchive Dir::Cache::archives)

 

# sanity check

if [ -z "$CacheDir" -o -z "$CacheArchive" ]; then

echo "empty Dir::Cache or Dir::Cache::archives, exiting"

exit

fi

 

Cache="${Dir%/}/${CacheDir%/}/${CacheArchive%/}/"

 

# check age

if [ ! $MaxAge -eq 0 ] && [ ! $MinAge -eq 0 ]; then

find $Cache -name "*.deb" \( -mtime +$MaxAge -and -ctime +$MaxAge \) -and -not \( -mtime -$MinAge -or -ctime -$MinAge \) -print0 | xargs -r -0 rm -f

elif [ ! $MaxAge -eq 0 ]; then

find $Cache -name "*.deb" -ctime +$MaxAge -and -mtime +$MaxAge -print0 | xargs -r -0 rm -f

fi

 

# check size

if [ ! $MaxSize -eq 0 ]; then

# maxSize is in MB

MaxSize=$(($MaxSize*1024))

 

#get current time

now=$(date --date=$(date --iso-8601) +%s)

MinAge=$(($MinAge*24*60*60))

 

# reverse-sort by mtime

for file in $(ls -rt $Cache/*.deb 2>/dev/null); do

du=$(du -s $Cache)

size=${du%%/*}

# check if the cache is small enough

if [ $size -lt $MaxSize ]; then

break

fi

 

# check for MinAge of the file

if [ ! $MinAge -eq 0 ]; then

# check both ctime and mtime

mtime=$(stat -c %Y $file)

ctime=$(stat -c %Z $file)

if [ $mtime -gt $ctime ]; then

delta=$(($now-$mtime))

else

delta=$(($now-$ctime))

fi

#echo "$file ($delta), $MinAge"

if [ $delta -le $MinAge ]; then

#echo "Skiping $file (delta=$delta)"

break

fi

fi

 

# delete oldest file

rm -f $file

done

fi

}

 

 

UpdateInterval=0

DownloadUpgradeableInterval=0

eval $(apt-config shell UpdateInterval APT::Periodic::Update-Package-Lists DownloadUpgradeableInterval APT::Periodic::Download-Upgradeable-Packages)

AutocleanInterval=$DownloadUpgradeableInterval

eval $(apt-config shell AutocleanInterval APT::Periodic::Autoclean)

 

# laptop check, on_ac_power returns:

# 0 (true) System is on mains power

# 1 (false) System is not on mains power

# 255 (false) Power status could not be determined

# Desktop systems always return 255 it seems

if which on_ac_power >/dev/null; then

on_ac_power

if [ $? -eq 1 ]; then

exit 0

fi

fi

 

UPDATE_STAMP=/var/lib/apt/periodic/update-stamp

if check_stamp $UPDATE_STAMP $UpdateInterval; then

if apt-get -qq update 2>/dev/null; then

if which dbus-send >/dev/null; then

dbus-send --system / app.apt.dbus.updated boolean:true

fi

update_stamp $UPDATE_STAMP

fi

fi

 

DOWNLOAD_UPGRADEABLE_STAMP=/var/lib/apt/periodic/download-upgradeable-stamp

if check_stamp $DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then

apt-get -qq -d dist-upgrade 2>/dev/null

update_stamp $DOWNLOAD_UPGRADEABLE_STAMP

fi

 

AUTOCLEAN_STAMP=/var/lib/apt/periodic/autoclean-stamp

if check_stamp $AUTOCLEAN_STAMP $AutocleanInterval; then

apt-get -qq autoclean

update_stamp $AUTOCLEAN_STAMP

fi

 

# check cache size

check_size_constraints

Reply
#6
I'm guessing you're using ubuntu - that script looks like it performs some automatic updates. What's the script name? Does the name appear in any log files at all (/var/log/cron or something)?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)