title: How to write a script to stop and start glassfish server
body: <p>I am using glassfish server for my Application and this is the way i start and stop my glassfish server manually</p>
  
  <pre><code> /opt/glassfish4/bin/asadmin stop-domain
  
   /opt/glassfish4/bin/asadmin start-domain
  </code></pre>
  
  <p>My requirement is that daily at 11:30 PM i want to restart my server automatically through a script </p>
  
  <p>My question is that do i need to write two scripts ??</p>
  
  <p>and mentuion it in two entries in cron tab ??</p>
  
  <p>one for stopping </p>
  
  <pre><code> /opt/glassfish4/bin/asadmin stop-domain
  </code></pre>
  
  <p>and </p>
  
  <p>one for starting </p>
  
  <pre><code> /opt/glassfish4/bin/asadmin start-domain
  </code></pre>
  
  <p>Is this the correct way or else please guide me whats the correct way of doing this </p>