Can you cron any utility module in the admin utilties?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kayakbabe
    Mega Mivite




    • Jun 2008
    • 1520

    #1

    Can you cron any utility module in the admin utilties?

    I have searched for this because I know you can use wget on a cron job on your server to automate Weilands power search and other modules. However I want to cron a different module by a different developer that is in our admin utilties area.

    My question is:
    Can you setup a wget command that will login and execute an admin utilties (same as Bill Weilands power search)?

    if so, how?

    If not, does the utiltiy module have to have something special coded into it to allow this?

    Or is there a work around go make this happen?
  • ILoveHostasaurus
    Mega Mivite










    • Mar 2006
    • 4998

    #2
    Re: Can you cron any utility module in the admin utilties?

    Most of the time it's possible to figure out a way to do it. Where it's a lot more difficult, or impossible, is if the process you want to execute has a multi-screen sequence of events that need to occur before it starts doing the work, and the data submitted on each screen is not accumulated as hidden variables to be POST'ed to the next screen.

    For example, if, to trigger the operation you want, you have to go to utilities, pick the module, select some option such as "Perform operation X" and then on the next screen you have to choose to perform operation X on products and categories, submit, then on the final screen you have to choose a name of an output file or something like that before you finally get to execute. Those can be quite difficult to script but can sometimes still be done if, on that last screen before submitting, you view source of the frame and find every hidden variable with all the prior screens' input; then you can create a wget POST request that includes all the necessary data from all the screens and submits it all.

    Keep in mind that for these types of jobs to work at all, a store admin user/pass must be stored in the cron job as part of the URL so that may have security implications. Might be better to set them up as cron jobs not on the web server but on a local office server that has been secured from outside access.
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment

    • ILoveHostasaurus
      Mega Mivite










      • Mar 2006
      • 4998

      #3
      Re: Can you cron any utility module in the admin utilties?

      The format of the job is something like this:

      /path/to/wget -o /dev/null --post-data='Screen=SUTL&Action=SUTL&Store_Code=CODE&Modu le_Code=NAME&UserName=StoreAdmin&Password=PASSWORD &Submit=Login&variable1=value1&variable2=value2 ' https://www.domain.com/mm5/admin.mvc --no-check-certificate

      In the above you're replace the admin URL, CODE, NAME, StoreAdmin, PASSWORD and all the &variable# references with relevant settings to your store.
      David Hubbard
      CIO
      Miva
      [email protected]
      http://www.miva.com

      Comment

      • wcw
        Developer Partner

        • Mar 2006
        • 11329

        #4
        Re: Can you cron any utility module in the admin utilties?

        On the old servers an email would be sent with the status of the cron job. I don't know if that is the case now. But just in case, take a look at this warning.

        After you get it working, look at the end of the line and change it to read
        --no-check-certificate >/dev/null 2>&1
        This last part AFTER the word "certificate" suppresses the sending of an email. The email that gets sent could contain your login and password info in the subject so this line kills the email.
        Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
        Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
        Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
        Facebook http://www.facebook.com/EmporiumPlus
        Twitter http://twitter.com/emporiumplus

        Comment

        • kayakbabe
          Mega Mivite




          • Jun 2008
          • 1520

          #5
          Re: Can you cron any utility module in the admin utilties?

          thanks for the advice!
          I thought I had all the variables necessary and that it just wasn't working. Then I only saw example of Bill's modules being done this way. The thing I need to work is just a one button push to get the utility to do it's job, so from what you've both said, it should be possible.

          I'm getting this error in my wget output file (which I'm capuring with a -0 myfile on the wget command line)

          --2013-07-22 13:09:46-- https://MYDOMAIN/Merchant2/admin.mvc
          Resolving MYDOMAIN (MYDOMAIN)... 199.xx.xxx.xxx
          Connecting to MYDOMAIN (MYDOMAIN)|199.xx.xxx.xxx|:443... connected.
          WARNING: The certificate of ‚MYDOMAIN‚Äô is not trusted.
          WARNING: The certificate of ‚MYDOMAIN‚Äô hasn't got a known issuer.
          HTTP request sent, awaiting response... 200 OK
          Length: 3741 (3.7K) [text/html]
          admin.mvc: Permission denied


          Cannot write to ‘admin.mvc’ (Permission denied).


          Does this mean the admin username and login aren't working?

          Comment

          • ILoveHostasaurus
            Mega Mivite










            • Mar 2006
            • 4998

            #6
            Re: Can you cron any utility module in the admin utilties?

            Originally posted by wcw View Post
            On the old servers an email would be sent with the status of the cron job. I don't know if that is the case now. But just in case, take a look at this warning.
            On the newer servers under Scheduled Tasks -> username -> Settings you can choose whether emails are sent or not and adjust the address. They apply to all jobs though so if you only want to have emails from some, you'd want to redirect the output on the ones you don't want.
            David Hubbard
            CIO
            Miva
            [email protected]
            http://www.miva.com

            Comment

            • ILoveHostasaurus
              Mega Mivite










              • Mar 2006
              • 4998

              #7
              Re: Can you cron any utility module in the admin utilties?

              Originally posted by kayakbabe View Post
              thanks for the advice!
              I thought I had all the variables necessary and that it just wasn't working. Then I only saw example of Bill's modules being done this way. The thing I need to work is just a one button push to get the utility to do it's job, so from what you've both said, it should be possible.

              I'm getting this error in my wget output file (which I'm capuring with a -0 myfile on the wget command line)

              --2013-07-22 13:09:46-- https://MYDOMAIN/Merchant2/admin.mvc
              Resolving MYDOMAIN (MYDOMAIN)... 199.xx.xxx.xxx
              Connecting to MYDOMAIN (MYDOMAIN)|199.xx.xxx.xxx|:443... connected.
              WARNING: The certificate of ‚MYDOMAIN‚Äô is not trusted.
              WARNING: The certificate of ‚MYDOMAIN‚Äô hasn't got a known issuer.
              HTTP request sent, awaiting response... 200 OK
              Length: 3741 (3.7K) [text/html]
              admin.mvc: Permission denied


              Cannot write to ‘admin.mvc’ (Permission denied).


              Does this mean the admin username and login aren't working?
              The reason you're getting that error is because the correct argument for redirecting output is lowercase o, not zero, so it's trying to write a file called admin.mvc to the directory the cron job is executing from, which it can't do.

              Try changing it to -o /var/www/vhosts/domain/private/cronoutput.txt
              David Hubbard
              CIO
              Miva
              [email protected]
              http://www.miva.com

              Comment

              • kayakbabe
                Mega Mivite




                • Jun 2008
                • 1520

                #8
                Re: Can you cron any utility module in the admin utilties?

                I changed it to --output-document= since I"m using that form for all the flags on wget anyway.
                and I"m definitely getting a file created with the output in it. It's just that it seems the admin itself isn't allowing login. I must be missing some variables. ... Back to the drawing board. LOL.

                Comment

                • ILoveHostasaurus
                  Mega Mivite










                  • Mar 2006
                  • 4998

                  #9
                  Re: Can you cron any utility module in the admin utilties?

                  Do you have a .htaccess doing ip restrictions on the admin.mvc?
                  David Hubbard
                  CIO
                  Miva
                  [email protected]
                  http://www.miva.com

                  Comment

                  • kayakbabe
                    Mega Mivite




                    • Jun 2008
                    • 1520

                    #10
                    Re: Can you cron any utility module in the admin utilties?

                    Nope, no ip restriction set up yet. Want to get everything working first.
                    I"m actually using wget from my local unix pc to execute the wget command.
                    Your clue a out the file location turned me onto the correct folder and file permissions.

                    Figured this would be best for testing and when It's working I'd put in a cron on our web site server.
                    I'm actually getting the wget to work
                    Code:
                    HTTP request sent, awaiting response... 200 OK
                    Length: 374 [text/html]
                    Saving to: ‘/Users/USERNAME/downloads/cronout/runfeedscron4results.txt’
                    
                    
                    100%[======================================>] 374         --.-K/s   in 0s      
                    
                    
                    2013-07-22 15:52:05 (2.39 MB/s) - ‘/Users/USERNAME/downloads/cronout/runfeedscron4results.txt’ saved [374/374]
                    on my console now. I had to make my local folder writable.
                    But I can't seem to get the command to execute and do anything.
                    I know the database datestamp and also the file that is supposed to be created by the module isn't occuring.
                    I"ll ask Miva Design Team to help me out.

                    Comment

                    • ILoveHostasaurus
                      Mega Mivite










                      • Mar 2006
                      • 4998

                      #11
                      Re: Can you cron any utility module in the admin utilties?

                      The fact that your request produced output that is 374 bytes makes me think you were at least successful in triggering something to run because the normal login and error screens, if you didn't log in successfully, or you did something that produced a fatal error, should have produced more output than that; so perhaps just an issue with the variables, etc.
                      David Hubbard
                      CIO
                      Miva
                      [email protected]
                      http://www.miva.com

                      Comment

                      • kayakbabe
                        Mega Mivite




                        • Jun 2008
                        • 1520

                        #12
                        Re: Can you cron any utility module in the admin utilties?

                        Originally posted by ILoveHostasaurus View Post
                        [snip]if you didn't log in successfully, or you did something that produced a fatal error, should have produced more output than that; so perhaps just an issue with the variables, etc.
                        That makes me feel a lot better. :-) At least I"m not a complete idiot. LOL.
                        I'll have Miva Design Team dig into it. It sounds like you guys at Miva really know what you are doing. I"ll bet it will take a lot less time than I've frizzled away trying to figure it out myself.

                        Comment

                        • Bruce - PhosphorMedia
                          Developer Partner











                          • Mar 2006
                          • 11256

                          #13
                          Re: Can you cron any utility module in the admin utilties?

                          Dave,

                          Can you elaborate on what you are implying in the following paragraph:

                          "Keep in mind that for these types of jobs to work at all, a store admin user/pass must be stored in the cron job as part of the URL so that may have security implications. Might be better to set them up as cron jobs not on the web server but on a local office server that has been secured from outside access. "

                          Is it just that, once a person has access to the CRON tab, they could also get access to the Admin? If so, wouldn't this be 'meh' as in, if I have access to CRON, I probably also have access to databases...which means anything I can get from the admin?
                          Bruce Golub
                          Phosphor Media - "Your Success is our Business"

                          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                          phosphormedia.com

                          Comment

                          • ILoveHostasaurus
                            Mega Mivite










                            • Mar 2006
                            • 4998

                            #14
                            Re: Can you cron any utility module in the admin utilties?

                            Originally posted by Bruce - PhosphorMedia View Post
                            Is it just that, once a person has access to the CRON tab, they could also get access to the Admin? If so, wouldn't this be 'meh' as in, if I have access to CRON, I probably also have access to databases...which means anything I can get from the admin?
                            That is true, but there are numerous ways to get access to what is in the crontab besides just having the control panel credentials. Any script on the website that executes as the user could easily call the crontab -l command to output the jobs associated with that user, so by storing admin credentials in a cron job, you're effectively granting any and every application that executes with the rights associated with your username the ability to gain access to your store admin. So, for example, a hacked wordpress plugin could give the person access to the store admin.
                            David Hubbard
                            CIO
                            Miva
                            [email protected]
                            http://www.miva.com

                            Comment

                            Working...
                            X