<?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 Multiple Users Deletion Through Scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/multiple-users-deletion-through-scripts/m-p/5880213#M638855</link>
    <description>&lt;P&gt;Hi Experts&lt;/P&gt;
&lt;P&gt;I have a list of users to be deleted in a Server.&lt;BR /&gt;I have the file having the list of user list (For eg./tmp/userlist)&lt;BR /&gt;My requirement was the script that delete all the users in the specified file .&lt;BR /&gt;before that it will check the below points&lt;/P&gt;
&lt;P&gt;weather the user in the list exixt or not&lt;BR /&gt;Home dir for that user found or not&lt;BR /&gt;any cron jobs shedule for the user&lt;/P&gt;
&lt;P&gt;I also include the sample commands for that&lt;/P&gt;
&lt;P&gt;grep xyz /etc/group&amp;nbsp;&amp;nbsp;&lt;BR /&gt;grep xyz /etc/passwd the user must there else exit and print user not found.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;ls -ld /home/xyz..&lt;BR /&gt;grep xyz /var/adm/cron/cron.allow&lt;BR /&gt;ll /var/spool/cron/crontabs/ | grep xyz&lt;BR /&gt;crontab -l | grep /home/xyz&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. This thread has been moved from HP-UX &amp;gt;&amp;nbsp;General to HP-UX &amp;gt; Languages - HP Forums Moderator&lt;/P&gt;</description>
    <pubDate>Wed, 28 Nov 2012 02:37:11 GMT</pubDate>
    <dc:creator>Ajin_1</dc:creator>
    <dc:date>2012-11-28T02:37:11Z</dc:date>
    <item>
      <title>Multiple Users Deletion Through Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/multiple-users-deletion-through-scripts/m-p/5880213#M638855</link>
      <description>&lt;P&gt;Hi Experts&lt;/P&gt;
&lt;P&gt;I have a list of users to be deleted in a Server.&lt;BR /&gt;I have the file having the list of user list (For eg./tmp/userlist)&lt;BR /&gt;My requirement was the script that delete all the users in the specified file .&lt;BR /&gt;before that it will check the below points&lt;/P&gt;
&lt;P&gt;weather the user in the list exixt or not&lt;BR /&gt;Home dir for that user found or not&lt;BR /&gt;any cron jobs shedule for the user&lt;/P&gt;
&lt;P&gt;I also include the sample commands for that&lt;/P&gt;
&lt;P&gt;grep xyz /etc/group&amp;nbsp;&amp;nbsp;&lt;BR /&gt;grep xyz /etc/passwd the user must there else exit and print user not found.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;ls -ld /home/xyz..&lt;BR /&gt;grep xyz /var/adm/cron/cron.allow&lt;BR /&gt;ll /var/spool/cron/crontabs/ | grep xyz&lt;BR /&gt;crontab -l | grep /home/xyz&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. This thread has been moved from HP-UX &amp;gt;&amp;nbsp;General to HP-UX &amp;gt; Languages - HP Forums Moderator&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2012 02:37:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/multiple-users-deletion-through-scripts/m-p/5880213#M638855</guid>
      <dc:creator>Ajin_1</dc:creator>
      <dc:date>2012-11-28T02:37:11Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Users Deletion Through Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/multiple-users-deletion-through-scripts/m-p/5881431#M638856</link>
      <description>&lt;P&gt;&amp;gt;My requirement was the script that delete all the users in the specified file .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A skeleton script would be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for user in $(&amp;lt; /tmp/userlist); do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Check existence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id $user &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ $? -ne 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "User $user not found"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # check home directory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ ! -d $(eval echo ~$user) ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "User $user has no home directory"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # check crontab&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fgrep -q -x $user /var/adm/cron/cron.allow&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ $? -eq 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "User $user in /var/adm/cron/cron.allow"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if [ -f&amp;nbsp; /var/spool/cron/crontabs/$user ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "User $user has a crontab"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; fi&lt;BR /&gt;&amp;nbsp;&amp;nbsp; # ...&lt;/P&gt;&lt;P&gt;done&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2012 05:17:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/multiple-users-deletion-through-scripts/m-p/5881431#M638856</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-11-28T05:17:05Z</dc:date>
    </item>
  </channel>
</rss>

