<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Need a script ! in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855335#M98181</link>
    <description>you can add it in cronjob to run daily like this:&lt;BR /&gt;&lt;BR /&gt;Invoke command:  crontab -e&lt;BR /&gt;&lt;BR /&gt;and add following line which will run at midnight 12:00am everyday.&lt;BR /&gt;&lt;BR /&gt;0 0 * * * find /backup -xdev -ctime +2 -type f -exec rm {} \;</description>
    <pubDate>Fri, 01 Sep 2006 14:44:15 GMT</pubDate>
    <dc:creator>IT_2007</dc:creator>
    <dc:date>2006-09-01T14:44:15Z</dc:date>
    <item>
      <title>Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855333#M98179</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;We have a backup job which creates a directory everyday with the name of the day. I would like to delete the directory 2days old every day at 6:00 sothat it will not fillup the filesystems.&lt;BR /&gt;&lt;BR /&gt;root@hp01:/backup# ll&lt;BR /&gt;total 0&lt;BR /&gt;drwxr-x---   2 root       sys             96 Aug  30 12:35 20060830&lt;BR /&gt;drwxr-x---   2 root       sys             96 Aug  31 12:35 20060831&lt;BR /&gt;drwxr-x---   2 root       sys             96 Sep  1 12:35 20060901&lt;BR /&gt;root@hp01:/backup#&lt;BR /&gt;&lt;BR /&gt;How can i do this ? &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Sep 2006 14:39:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855333#M98179</guid>
      <dc:creator>Silver_1</dc:creator>
      <dc:date>2006-09-01T14:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855334#M98180</link>
      <description>you can use find command and delete them  files under two days.&lt;BR /&gt;&lt;BR /&gt;find /backup -xdev -ctime +2 -type f -exec rm {} \;</description>
      <pubDate>Fri, 01 Sep 2006 14:42:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855334#M98180</guid>
      <dc:creator>IT_2007</dc:creator>
      <dc:date>2006-09-01T14:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855335#M98181</link>
      <description>you can add it in cronjob to run daily like this:&lt;BR /&gt;&lt;BR /&gt;Invoke command:  crontab -e&lt;BR /&gt;&lt;BR /&gt;and add following line which will run at midnight 12:00am everyday.&lt;BR /&gt;&lt;BR /&gt;0 0 * * * find /backup -xdev -ctime +2 -type f -exec rm {} \;</description>
      <pubDate>Fri, 01 Sep 2006 14:44:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855335#M98181</guid>
      <dc:creator>IT_2007</dc:creator>
      <dc:date>2006-09-01T14:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855336#M98182</link>
      <description>The command above will only delete the files, not the directory.&lt;BR /&gt;&lt;BR /&gt;If you want to delete the directory:&lt;BR /&gt;&lt;BR /&gt;# find /backup -type d -mtime +2 -exec rm -rf {} \;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Sep 2006 14:46:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855336#M98182</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-09-01T14:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855337#M98183</link>
      <description>Create a script that is called by cron daily at 0600.&lt;BR /&gt;--------------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;PATH=${PATH}:/usr/bin:/usr/local/bin&lt;BR /&gt;export PATH&lt;BR /&gt;&lt;BR /&gt;typeset DTMINUS2=""&lt;BR /&gt;typeset BDIR=/backup&lt;BR /&gt;typeset DNAME=""&lt;BR /&gt;typeset -i STAT=0&lt;BR /&gt;&lt;BR /&gt;DTMINUS2=$(caljd.sh -y -s $(caljd.sh -p 2))&lt;BR /&gt;DNAME=${BDIR}/${DTMINUS2}&lt;BR /&gt;if [[ -d "${DNAME}" ]]&lt;BR /&gt;  then&lt;BR /&gt;    rm -rf "${DNAME}"&lt;BR /&gt;    STAT=${?}&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;--------------------------------&lt;BR /&gt;&lt;BR /&gt;Now download the attached caljd.sh and install it in /usr/local/bin and make it executable.&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for usage and example to see what it is doing.&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Sep 2006 14:48:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855337#M98183</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-09-01T14:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need a script !</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855338#M98184</link>
      <description>Hi Silver:&lt;BR /&gt;&lt;BR /&gt;You could also use this:&lt;BR /&gt;&lt;BR /&gt;# cd /backup &amp;amp;&amp;amp; perl -MPOSIX=strftime -e '$name=strftime("%Y%m%d",localtime(time-(86400*2)));system("rm -r $name")'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 01 Sep 2006 15:55:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-a-script/m-p/3855338#M98184</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-01T15:55:44Z</dc:date>
    </item>
  </channel>
</rss>

