Perl is making my head explode
May 21, 2010 1:55 PM Subscribe
Script-filter: I've been tasked with finding out who at our company is synchronizing to their home folders on our fileservers, and how often. Although initially it was recommended I do this in perl, my head is blowing up trying to get it to work. Lots of blundering attempts to ask for help inside.
I hate scripting in perl. Hate it. I don't have an alternative scripting language I prefer. They all seem to make me react the same way. My head simply locks up and refuses to learn it, which I recognize as a very real problem. I can configure routers and switches all day long, and I've created shell scripts and batch files with very little trouble. But perl seems to be a different animal entirely for me.
Let's say for this we have 6 locations, all meshed via VPN and all accessible on the domain. Each location has a Win2k3 file server. On each file server, there is a \home\department directory for each department. In each \home\department directory, there is a "Users" folder. And in each "Users" folder, there is a folder for each user in that department.
My task as it was given to me: Find out who is using their home folder, and how often. To do this it was suggested I create a script that will go through these User directories (and subdirs) and pull up the last accessed (or modified) file date. Provide easy to understand results. So if I last synchronized my home directory on 5/19/2010, I would want an email or a text file resulting from the script to show:
Routergirl - 05/19/2010.
It would be nice, even, if it came back with something like:
Fileserver - Engineering - Routergirl - 05/19/2010.
My current script has had me baffled for several days, and when I go to people in the company who know more about perl than I do, they seem to either want to run with it and create a new one on their own that still doesn't work, or they're too busy to help me. The person who has been the most help is my brother, who is currently 3k miles away and busy with his own job. Although perl was initially recommended by my boss, he is perfectly willing to accept other methods that provide the hoped for results.
Is there a better way to do this? Could it be that perl is just the wrong solution? Maybe there is some automated free program we could be using for this that would save a load of headaches. I'm not convinced that checking last modified or last accessed date on the files will even be a good check for this. People could circumvent it by browsing to their home folder on the fileserver and just modifying a file, therefore not actually synchronizing, but bringing up current results. Maybe there is something that can actually check when a user last accessed the directory itself?
Entirely open to any and all suggestions. I realize this question is fairly scattered. If it comes down to all of you saying, "Yes, perl is the best way to do this," then I know to sign myself up for some force feeding...errrr....classes. If anyone can provide resources on existing scripts that do this exact thing already (my google fu has failed me so far - they're all just enough different that they won't work), that would be much appreciated. If anyone knows of a better way - please tell me, cos maybe I'm just missing the obvious, and I've been known to overthink.
posted by routergirl to computers & internet (15 answers total)
What you first need to figure out is *exactly* how to get the answer you need - is checking last-modified-date the right way to do it? What if the user is syncing the other way, and the activity on the share is read-only? Do you have a record of last-accessed date at all? Log files that show when the share was last accessed? anything like that?
Don't even bother figuring out what to write it in until you have the answer to that question.
After that, I'd use whatever the standard scripting language is at your employer for this kind of task - that varies from company to company.
FWIW, perl is *fantastic* for this kind of stuff, but that's not your immediate issue.
posted by swngnmonk at 2:05 PM on May 21, 2010 [2 favorites]