I am setting up a fedora web server and have an html form that when clicked will call test.cgi. Test.cgi will then write to a crontab. My problem is that my cgi script(var/www/cgi-bin/test.cgi) does not write to my crontab file(home/jma/Documents/cron-tab) at all. Permissions for my test.cgi file is 755. Permissions for my cron-tab file is 777(I know I should change this but just trying it for now so I can write to it).
Code for test.cgi
#!/usr/bin/perl use CGI; print "Content-type: text/html\n\n"; open(OUT, ">>/home/jma/Documents/cron-job"); print OUT "blah\n";
Can anyone tell me what I am doing wrong and why test.cgi does not write to cron-tab correctly?? I guess this is probably not the safest way to process the data. I've been hearing that I shouldn't write directly to a crontab file. Can anyone tell me an easier way to do this? Thanks!

In reply to how to avoid web server from getting hacked by Niner710

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.